[PATCH 2/4] convert internal frequencies to KHz

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In preparation for supporting (S1G) channels centered on
non-integer MHz, such as 902.5Mhz, convert nearly all
internal frequency representations into units of KHz.

A conversion must be done when:

- parsing existing API, ie. control interface, dbus, etc.
- parsing config files
- sending driver commands
- receiving driver events

When the user input is a string, we parse the input as a
MHz float, then convert to KHz. This will existing
commands to work on S1G channels unchanged.

When generating events and log messages, we exploit the
"%g" format specifier which will drop the "." and
trailing zeroes if the input does not have a fractional
component. Similar to parsing user input this lets us
expose fractional MHz frequencies without disturbing
existing users.

The hwsim tests (driver_nl80211) still pass as well as
they can.

While dbus, driver_bsd, driver_atheros, driver_hostap,
driver_privsep, driver_wext, etc. have been converted
based on 'git grep freq ...', they have received no
testing :(. Suggestions, extra review, or help testing
these are welcome.

This commit should introduce no functional change.

Signed-off-by: Thomas Pedersen <thomas@xxxxxxxxxxxx>
---
 hostapd/config_file.c                       |  16 +-
 hostapd/ctrl_iface.c                        |  59 ++---
 src/ap/acs.c                                |  20 +-
 src/ap/ctrl_iface_ap.c                      |   9 +-
 src/ap/dfs.c                                | 105 +++++----
 src/ap/dpp_hostapd.c                        | 105 ++++-----
 src/ap/drv_callbacks.c                      |  41 ++--
 src/ap/gas_query_ap.c                       |  12 +-
 src/ap/hostapd.c                            |  18 +-
 src/ap/hw_features.c                        |  57 ++---
 src/ap/ieee802_11.c                         |   5 +-
 src/ap/ieee802_11_ht.c                      |  16 +-
 src/ap/ieee802_11_shared.c                  |  12 +-
 src/ap/neighbor_db.c                        |   2 +-
 src/ap/wnm_ap.c                             |   6 +-
 src/ap/wpa_auth.c                           |  10 +-
 src/ap/wpa_auth_ft.c                        |   6 +-
 src/common/dpp.c                            |  33 +--
 src/common/gas_server.c                     |  14 +-
 src/common/hw_features_common.c             |  71 +++---
 src/common/ieee802_11_common.c              | 115 +++++-----
 src/common/ieee802_11_defs.h                |   4 +
 src/common/ocv.c                            |   6 +-
 src/common/wpa_common.c                     |   2 +-
 src/drivers/driver.h                        |  30 +--
 src/drivers/driver_atheros.c                |   4 +-
 src/drivers/driver_bsd.c                    |   3 +-
 src/drivers/driver_hostap.c                 |   2 +-
 src/drivers/driver_ndis.c                   |   2 +-
 src/drivers/driver_nl80211.c                | 180 ++++++++-------
 src/drivers/driver_nl80211_capa.c           |  81 ++++---
 src/drivers/driver_nl80211_event.c          |  66 +++---
 src/drivers/driver_nl80211_scan.c           |  14 +-
 src/drivers/driver_privsep.c                |  12 +-
 src/drivers/driver_wext.c                   |   2 +-
 src/eap_peer/eap_pwd.c                      |   2 +-
 src/p2p/p2p.c                               |  82 +++----
 src/p2p/p2p.h                               |   2 +-
 src/p2p/p2p_build.c                         |   4 +-
 src/p2p/p2p_dev_disc.c                      |   2 +-
 src/p2p/p2p_go_neg.c                        |  10 +-
 src/p2p/p2p_invitation.c                    |   8 +-
 src/p2p/p2p_pd.c                            |   4 +-
 src/p2p/p2p_sd.c                            |   4 +-
 src/p2p/p2p_utils.c                         |  16 +-
 src/rsn_supp/wpa.c                          |   5 +-
 src/utils/common.c                          |  29 ++-
 src/utils/common.h                          |   1 +
 tests/ap-mgmt-fuzzer/ap-mgmt-fuzzer.c       |   2 +-
 tests/hwsim/test_wpas_ctrl.py               |   8 +-
 wpa_supplicant/ap.c                         |  23 +-
 wpa_supplicant/bgscan_learn.c               |  18 +-
 wpa_supplicant/bss.c                        |   4 +-
 wpa_supplicant/bss.h                        |   4 +-
 wpa_supplicant/config.c                     |  84 +++++--
 wpa_supplicant/config_file.c                |  14 +-
 wpa_supplicant/ctrl_iface.c                 | 108 +++++----
 wpa_supplicant/dbus/dbus_new.c              |   8 +-
 wpa_supplicant/dbus/dbus_new_handlers.c     |  25 +-
 wpa_supplicant/dbus/dbus_new_handlers_p2p.c |  12 +-
 wpa_supplicant/dpp_supplicant.c             | 190 ++++++++--------
 wpa_supplicant/events.c                     |  56 ++---
 wpa_supplicant/gas_query.c                  |  23 +-
 wpa_supplicant/interworking.c               |   2 +-
 wpa_supplicant/mesh.c                       |  10 +-
 wpa_supplicant/offchannel.c                 |  20 +-
 wpa_supplicant/op_classes.c                 |   8 +-
 wpa_supplicant/p2p_supplicant.c             | 238 ++++++++++----------
 wpa_supplicant/rrm.c                        |   7 +-
 wpa_supplicant/scan.c                       |  25 +-
 wpa_supplicant/scan.h                       |   2 +-
 wpa_supplicant/sme.c                        |  55 ++---
 wpa_supplicant/wnm_sta.c                    |  10 +-
 wpa_supplicant/wpa_supplicant.c             |  30 +--
 wpa_supplicant/wps_supplicant.c             |  32 +--
 75 files changed, 1258 insertions(+), 1069 deletions(-)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 8f7fcd8b762c..a7e464f11455 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -859,7 +859,7 @@ static int hostapd_parse_chanlist(struct hostapd_config *conf, char *val)
 		if (pos)
 			*pos++ = ',';
 	}
-	if (freq_range_list_parse(&conf->acs_ch_list, val))
+	if (int_range_list_parse(&conf->acs_ch_list, val))
 		return -1;
 
 	return 0;
@@ -4165,19 +4165,19 @@ static int hostapd_config_fill(struct hostapd_config *conf,
 	} else if (os_strcmp(buf, "ft_rsnxe_used") == 0) {
 		bss->ft_rsnxe_used = atoi(pos);
 	} else if (os_strcmp(buf, "oci_freq_override_eapol_m3") == 0) {
-		bss->oci_freq_override_eapol_m3 = atoi(pos);
+		bss->oci_freq_override_eapol_m3 = KHZ(atof(pos));
 	} else if (os_strcmp(buf, "oci_freq_override_eapol_g1") == 0) {
-		bss->oci_freq_override_eapol_g1 = atoi(pos);
+		bss->oci_freq_override_eapol_g1 = KHZ(atof(pos));
 	} else if (os_strcmp(buf, "oci_freq_override_saquery_req") == 0) {
-		bss->oci_freq_override_saquery_req = atoi(pos);
+		bss->oci_freq_override_saquery_req = KHZ(atof(pos));
 	} else if (os_strcmp(buf, "oci_freq_override_saquery_resp") == 0) {
-		bss->oci_freq_override_saquery_resp = atoi(pos);
+		bss->oci_freq_override_saquery_resp = KHZ(atof(pos));
 	} else if (os_strcmp(buf, "oci_freq_override_ft_assoc") == 0) {
-		bss->oci_freq_override_ft_assoc = atoi(pos);
+		bss->oci_freq_override_ft_assoc = KHZ(atof(pos));
 	} else if (os_strcmp(buf, "oci_freq_override_fils_assoc") == 0) {
-		bss->oci_freq_override_fils_assoc = atoi(pos);
+		bss->oci_freq_override_fils_assoc = KHZ(atof(pos));
 	} else if (os_strcmp(buf, "oci_freq_override_wnm_sleep") == 0) {
-		bss->oci_freq_override_wnm_sleep = atoi(pos);
+		bss->oci_freq_override_wnm_sleep = KHZ(atof(pos));
 #endif /* CONFIG_TESTING_OPTIONS */
 #ifdef CONFIG_SAE
 	} else if (os_strcmp(buf, "sae_password") == 0) {
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index b470c5643f99..97e695b98b22 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -1490,19 +1490,20 @@ static int hostapd_ctrl_iface_set(struct hostapd_data *hapd, char *cmd)
 		else if (os_strcmp(cmd, "oci_freq_override_eapol_m3") == 0)
 			wpa_auth_set_ocv_override_freq(
 				hapd->wpa_auth, WPA_AUTH_OCV_OVERRIDE_EAPOL_M3,
-				atoi(value));
+				KHZ(atof(value)));
 		else if (os_strcmp(cmd, "oci_freq_override_eapol_g1") == 0)
 			wpa_auth_set_ocv_override_freq(
 				hapd->wpa_auth, WPA_AUTH_OCV_OVERRIDE_EAPOL_G1,
-				atoi(value));
+				KHZ(atof(value)));
 		else if (os_strcmp(cmd, "oci_freq_override_ft_assoc") == 0)
 			wpa_auth_set_ocv_override_freq(
 				hapd->wpa_auth, WPA_AUTH_OCV_OVERRIDE_FT_ASSOC,
-				atoi(value));
+				KHZ(atof(value)));
 		else if (os_strcmp(cmd, "oci_freq_override_fils_assoc") == 0)
 			wpa_auth_set_ocv_override_freq(
 				hapd->wpa_auth,
-				WPA_AUTH_OCV_OVERRIDE_FILS_ASSOC, atoi(value));
+				WPA_AUTH_OCV_OVERRIDE_FILS_ASSOC,
+				KHZ(atof(value)));
 #endif /* CONFIG_TESTING_OPTIONS */
 	}
 
@@ -1653,7 +1654,7 @@ static int hostapd_ctrl_iface_radar(struct hostapd_data *hapd, char *cmd)
 
 	pos = os_strstr(param, "freq=");
 	if (pos)
-		data.dfs_event.freq = atoi(pos + 5);
+		data.dfs_event.freq = KHZ(atof(pos + 5));
 
 	pos = os_strstr(param, "ht_enabled=1");
 	if (pos)
@@ -1669,11 +1670,11 @@ static int hostapd_ctrl_iface_radar(struct hostapd_data *hapd, char *cmd)
 
 	pos = os_strstr(param, "cf1=");
 	if (pos)
-		data.dfs_event.cf1 = atoi(pos + 4);
+		data.dfs_event.cf1 = KHZ(atof(pos + 4));
 
 	pos = os_strstr(param, "cf2=");
 	if (pos)
-		data.dfs_event.cf2 = atoi(pos + 4);
+		data.dfs_event.cf2 = KHZ(atof(pos + 4));
 
 	wpa_supplicant_event(hapd, event, &data);
 
@@ -1790,7 +1791,7 @@ static int hostapd_ctrl_iface_mgmt_rx_process(struct hostapd_data *hapd,
 	param = os_strstr(pos, "freq=");
 	if (param) {
 		param += 5;
-		freq = atoi(param);
+		freq = KHZ(atof(param));
 	}
 
 	param = os_strstr(pos, " datarate=");
@@ -2509,11 +2510,11 @@ static int hostapd_ctrl_check_freq_params(struct hostapd_freq_params *params)
 			break;
 		switch (params->sec_channel_offset) {
 		case 1:
-			if (params->freq + 10 != params->center_freq1)
+			if (params->freq + KHZ(10) != params->center_freq1)
 				return -1;
 			break;
 		case -1:
-			if (params->freq - 10 != params->center_freq1)
+			if (params->freq - KHZ(10) != params->center_freq1)
 				return -1;
 			break;
 		default:
@@ -2526,13 +2527,13 @@ static int hostapd_ctrl_check_freq_params(struct hostapd_freq_params *params)
 
 		switch (params->sec_channel_offset) {
 		case 1:
-			if (params->freq - 10 != params->center_freq1 &&
-			    params->freq + 30 != params->center_freq1)
+			if (params->freq - KHZ(10) != params->center_freq1 &&
+			    params->freq + KHZ(30) != params->center_freq1)
 				return 1;
 			break;
 		case -1:
-			if (params->freq + 10 != params->center_freq1 &&
-			    params->freq - 30 != params->center_freq1)
+			if (params->freq + KHZ(10) != params->center_freq1 &&
+			    params->freq - KHZ(30) != params->center_freq1)
 				return -1;
 			break;
 		default:
@@ -2541,8 +2542,8 @@ static int hostapd_ctrl_check_freq_params(struct hostapd_freq_params *params)
 
 		/* Adjacent and overlapped are not allowed for 80+80 */
 		if (params->center_freq2 &&
-		    params->center_freq1 - params->center_freq2 <= 80 &&
-		    params->center_freq2 - params->center_freq1 <= 80)
+		    params->center_freq1 - params->center_freq2 <= KHZ(80) &&
+		    params->center_freq2 - params->center_freq1 <= KHZ(80))
 			return 1;
 		break;
 	case 160:
@@ -2552,17 +2553,17 @@ static int hostapd_ctrl_check_freq_params(struct hostapd_freq_params *params)
 
 		switch (params->sec_channel_offset) {
 		case 1:
-			if (params->freq + 70 != params->center_freq1 &&
-			    params->freq + 30 != params->center_freq1 &&
-			    params->freq - 10 != params->center_freq1 &&
-			    params->freq - 50 != params->center_freq1)
+			if (params->freq + KHZ(70) != params->center_freq1 &&
+			    params->freq + KHZ(30) != params->center_freq1 &&
+			    params->freq - KHZ(10) != params->center_freq1 &&
+			    params->freq - KHZ(50) != params->center_freq1)
 				return -1;
 			break;
 		case -1:
-			if (params->freq + 50 != params->center_freq1 &&
-			    params->freq + 10 != params->center_freq1 &&
-			    params->freq - 30 != params->center_freq1 &&
-			    params->freq - 70 != params->center_freq1)
+			if (params->freq + KHZ(50) != params->center_freq1 &&
+			    params->freq + KHZ(10) != params->center_freq1 &&
+			    params->freq - KHZ(30) != params->center_freq1 &&
+			    params->freq - KHZ(70) != params->center_freq1)
 				return -1;
 			break;
 		default:
@@ -2633,8 +2634,8 @@ static int hostapd_ctrl_iface_chan_switch(struct hostapd_iface *iface,
 		ret = ieee80211_freq_to_chan(settings.freq_params.freq, &chan);
 		if (ret == NUM_HOSTAPD_MODES) {
 			wpa_printf(MSG_ERROR,
-				   "Failed to get channel for (freq=%d, sec_channel_offset=%d, bw=%d)",
-				   settings.freq_params.freq,
+				   "Failed to get channel for (freq=%g, sec_channel_offset=%d, bw=%d)",
+				   PR_KHZ(settings.freq_params.freq),
 				   settings.freq_params.sec_channel_offset,
 				   settings.freq_params.bandwidth);
 			return -1;
@@ -2643,12 +2644,12 @@ static int hostapd_ctrl_iface_chan_switch(struct hostapd_iface *iface,
 		settings.freq_params.channel = chan;
 
 		wpa_printf(MSG_DEBUG,
-			   "DFS/CAC to (channel=%u, freq=%d, sec_channel_offset=%d, bw=%d, center_freq1=%d)",
+			   "DFS/CAC to (channel=%u, freq=%g, sec_channel_offset=%d, bw=%d, center_freq1=%g)",
 			   settings.freq_params.channel,
-			   settings.freq_params.freq,
+			   PR_KHZ(settings.freq_params.freq),
 			   settings.freq_params.sec_channel_offset,
 			   settings.freq_params.bandwidth,
-			   settings.freq_params.center_freq1);
+			   PR_KHZ(settings.freq_params.center_freq1));
 
 		/* Perform CAC and switch channel */
 		hostapd_switch_channel_fallback(iface, &settings.freq_params);
diff --git a/src/ap/acs.c b/src/ap/acs.c
index aa2ceb0d1848..e58260e62d55 100644
--- a/src/ap/acs.c
+++ b/src/ap/acs.c
@@ -541,8 +541,8 @@ static void acs_survey_mode_interference_factor(
 		if (!is_in_freqlist(iface, chan))
 			continue;
 
-		wpa_printf(MSG_DEBUG, "ACS: Survey analysis for channel %d (%d MHz)",
-			   chan->chan, chan->freq);
+		wpa_printf(MSG_DEBUG, "ACS: Survey analysis for channel %d (%g MHz)",
+			   chan->chan, PR_KHZ(chan->freq));
 
 		acs_survey_chan_interference_factor(iface, chan);
 
@@ -713,7 +713,8 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface,
 		total_weight = 1;
 
 		for (j = 1; j < n_chans; j++) {
-			adj_chan = acs_find_chan(iface, chan->freq + (j * 20));
+			adj_chan = acs_find_chan(iface, chan->freq +
+						        KHZ((j * 20)));
 			if (!adj_chan)
 				break;
 
@@ -741,7 +742,7 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface,
 		if (is_24ghz_mode(mode->mode)) {
 			for (j = 0; j < n_chans; j++) {
 				adj_chan = acs_find_chan(iface, chan->freq +
-							 (j * 20) - 5);
+							 KHZ((j * 20) - 5));
 				if (adj_chan && acs_usable_chan(adj_chan)) {
 					factor += ACS_ADJ_WEIGHT *
 						adj_chan->interference_factor;
@@ -749,7 +750,7 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface,
 				}
 
 				adj_chan = acs_find_chan(iface, chan->freq +
-							 (j * 20) - 10);
+							 KHZ((j * 20) - 10));
 				if (adj_chan && acs_usable_chan(adj_chan)) {
 					factor += ACS_NEXT_ADJ_WEIGHT *
 						adj_chan->interference_factor;
@@ -757,7 +758,7 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface,
 				}
 
 				adj_chan = acs_find_chan(iface, chan->freq +
-							 (j * 20) + 5);
+							 KHZ((j * 20) + 5));
 				if (adj_chan && acs_usable_chan(adj_chan)) {
 					factor += ACS_ADJ_WEIGHT *
 						adj_chan->interference_factor;
@@ -765,7 +766,7 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface,
 				}
 
 				adj_chan = acs_find_chan(iface, chan->freq +
-							 (j * 20) + 10);
+							 KHZ((j * 20) + 10));
 				if (adj_chan && acs_usable_chan(adj_chan)) {
 					factor += ACS_NEXT_ADJ_WEIGHT *
 						adj_chan->interference_factor;
@@ -871,8 +872,9 @@ acs_find_ideal_chan(struct hostapd_iface *iface)
 	}
 
 	if (ideal_chan) {
-		wpa_printf(MSG_DEBUG, "ACS: Ideal channel is %d (%d MHz) with total interference factor of %Lg",
-			   ideal_chan->chan, ideal_chan->freq, ideal_factor);
+		wpa_printf(MSG_DEBUG, "ACS: Ideal channel is %d (%g MHz) with total interference factor of %Lg",
+			   ideal_chan->chan, PR_KHZ(ideal_chan->freq),
+			   ideal_factor);
 		return ideal_chan;
 	}
 
diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c
index ef53a82548ff..e5590cafabf8 100644
--- a/src/ap/ctrl_iface_ap.c
+++ b/src/ap/ctrl_iface_ap.c
@@ -680,7 +680,7 @@ int hostapd_ctrl_iface_status(struct hostapd_data *hapd, char *buf,
 	ret = os_snprintf(buf + len, buflen - len,
 			  "state=%s\n"
 			  "phy=%s\n"
-			  "freq=%d\n"
+			  "freq=%g\n"
 			  "num_sta_non_erp=%d\n"
 			  "num_sta_no_short_slot_time=%d\n"
 			  "num_sta_no_short_preamble=%d\n"
@@ -693,7 +693,7 @@ int hostapd_ctrl_iface_status(struct hostapd_data *hapd, char *buf,
 			  "ht_op_mode=0x%x\n",
 			  hostapd_state_text(iface->state),
 			  iface->phy,
-			  iface->freq,
+			  PR_KHZ(iface->freq),
 			  iface->num_sta_non_erp,
 			  iface->num_sta_no_short_slot_time,
 			  iface->num_sta_no_short_preamble,
@@ -887,7 +887,7 @@ int hostapd_parse_csa_settings(const char *pos,
 		return -1;
 	}
 
-	settings->freq_params.freq = atoi(end);
+	settings->freq_params.freq = KHZ(atof(end));
 	if (settings->freq_params.freq == 0) {
 		wpa_printf(MSG_ERROR, "chanswitch: invalid freq provided");
 		return -1;
@@ -904,6 +904,9 @@ int hostapd_parse_csa_settings(const char *pos,
 
 	SET_CSA_SETTING(center_freq1);
 	SET_CSA_SETTING(center_freq2);
+	/* TODO: fixup for now, but should have parsed as floats */
+	settings->freq_params.center_freq1 = KHZ(settings->freq_params.center_freq1);
+	settings->freq_params.center_freq2 = KHZ(settings->freq_params.center_freq2);
 	SET_CSA_SETTING(bandwidth);
 	SET_CSA_SETTING(sec_channel_offset);
 	settings->freq_params.ht_enabled = !!os_strstr(pos, " ht");
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index 3c078b9cbf02..b47aebf3e17c 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -161,25 +161,25 @@ static int dfs_chan_range_available(struct hostapd_hw_modes *mode,
 	}
 
 	for (i = 0; i < num_chans; i++) {
-		chan = dfs_get_chan_data(mode, first_chan->freq + i * 20,
+		chan = dfs_get_chan_data(mode, first_chan->freq + KHZ(i * 20),
 					 first_chan_idx);
 		if (!chan) {
-			wpa_printf(MSG_DEBUG, "DFS: no channel data for %d",
-				   first_chan->freq + i * 20);
+			wpa_printf(MSG_DEBUG, "DFS: no channel data for %g",
+				   PR_KHZ(first_chan->freq + KHZ(i * 20)));
 			return 0;
 		}
 
 		/* HT 40 MHz secondary channel availability checked only for
 		 * primary channel */
 		if (!chan_bw_allowed(chan, bw, 1, !i)) {
-			wpa_printf(MSG_DEBUG, "DFS: bw now allowed for %d",
-				   first_chan->freq + i * 20);
+			wpa_printf(MSG_DEBUG, "DFS: bw now allowed for %g",
+				   PR_KHZ(first_chan->freq + KHZ(i * 20)));
 			return 0;
 		}
 
 		if (!dfs_channel_available(chan, skip_radar)) {
-			wpa_printf(MSG_DEBUG, "DFS: channel not available %d",
-				   first_chan->freq + i * 20);
+			wpa_printf(MSG_DEBUG, "DFS: channel not available %g",
+				   PR_KHZ(first_chan->freq + KHZ(i * 20)));
 			return 0;
 		}
 	}
@@ -226,23 +226,23 @@ static int dfs_find_channel(struct hostapd_iface *iface,
 		    (!dfs_is_chan_allowed(chan, n_chans) ||
 		     !(chan->allowed_bw & HOSTAPD_CHAN_WIDTH_40P))) {
 			wpa_printf(MSG_DEBUG,
-				   "DFS: channel %d (%d) is incompatible",
-				   chan->freq, chan->chan);
+				   "DFS: channel %g (%d) is incompatible",
+				   PR_KHZ(chan->freq), chan->chan);
 			continue;
 		}
 
 		/* Skip incompatible chandefs */
 		if (!dfs_chan_range_available(mode, i, n_chans, skip_radar)) {
 			wpa_printf(MSG_DEBUG,
-				   "DFS: range not available for %d (%d)",
-				   chan->freq, chan->chan);
+				   "DFS: range not available for %g (%d)",
+				   PR_KHZ(chan->freq), chan->chan);
 			continue;
 		}
 
 		if (!is_in_chanlist(iface, chan)) {
 			wpa_printf(MSG_DEBUG,
-				   "DFS: channel %d (%d) not in chanlist",
-				   chan->freq, chan->chan);
+				   "DFS: channel %g (%d) not in chanlist",
+				   PR_KHZ(chan->freq), chan->chan);
 			continue;
 		}
 
@@ -575,7 +575,8 @@ static int set_dfs_state_freq(struct hostapd_iface *iface, int freq, u32 state)
 	if (mode == NULL)
 		return 0;
 
-	wpa_printf(MSG_DEBUG, "set_dfs_state 0x%X for %d MHz", state, freq);
+	wpa_printf(MSG_DEBUG, "set_dfs_state 0x%X for %g MHz", state,
+		   PR_KHZ(freq));
 	for (i = 0; i < iface->current_mode->num_channels; i++) {
 		chan = &iface->current_mode->channels[i];
 		if (chan->freq == freq) {
@@ -586,7 +587,8 @@ static int set_dfs_state_freq(struct hostapd_iface *iface, int freq, u32 state)
 			}
 		}
 	}
-	wpa_printf(MSG_WARNING, "Can't set DFS state for freq %d MHz", freq);
+	wpa_printf(MSG_WARNING, "Can't set DFS state for freq %g MHz",
+		   PR_KHZ(freq));
 	return 0;
 }
 
@@ -620,20 +622,20 @@ static int set_dfs_state(struct hostapd_iface *iface, int freq, int ht_enabled,
 		break;
 	case CHAN_WIDTH_40:
 		n_chans = 2;
-		frequency = cf1 - 10;
+		frequency = cf1 - KHZ(10);
 		break;
 	case CHAN_WIDTH_80:
 		n_chans = 4;
-		frequency = cf1 - 30;
+		frequency = cf1 - KHZ(30);
 		break;
 	case CHAN_WIDTH_80P80:
 		n_chans = 4;
-		frequency = cf1 - 30;
-		frequency2 = cf2 - 30;
+		frequency = cf1 - KHZ(30);
+		frequency2 = cf2 - KHZ(30);
 		break;
 	case CHAN_WIDTH_160:
 		n_chans = 8;
-		frequency = cf1 - 70;
+		frequency = cf1 - KHZ(70);
 		break;
 	default:
 		wpa_printf(MSG_INFO, "DFS chan_width %d not supported",
@@ -641,15 +643,15 @@ static int set_dfs_state(struct hostapd_iface *iface, int freq, int ht_enabled,
 		break;
 	}
 
-	wpa_printf(MSG_DEBUG, "DFS freq: %dMHz, n_chans: %d", frequency,
+	wpa_printf(MSG_DEBUG, "DFS freq: %gMHz, n_chans: %d", PR_KHZ(frequency),
 		   n_chans);
 	for (i = 0; i < n_chans; i++) {
 		ret += set_dfs_state_freq(iface, frequency, state);
-		frequency = frequency + 20;
+		frequency = frequency + KHZ(20);
 
 		if (chan_width == CHAN_WIDTH_80P80) {
 			ret += set_dfs_state_freq(iface, frequency2, state);
-			frequency2 = frequency2 + 20;
+			frequency2 = frequency2 + KHZ(20);
 		}
 	}
 
@@ -686,15 +688,15 @@ static int dfs_are_channels_overlapped(struct hostapd_iface *iface, int freq,
 		break;
 	case CHAN_WIDTH_40:
 		radar_n_chans = 2;
-		frequency = cf1 - 10;
+		frequency = cf1 - KHZ(10);
 		break;
 	case CHAN_WIDTH_80:
 		radar_n_chans = 4;
-		frequency = cf1 - 30;
+		frequency = cf1 - KHZ(30);
 		break;
 	case CHAN_WIDTH_160:
 		radar_n_chans = 8;
-		frequency = cf1 - 70;
+		frequency = cf1 - KHZ(70);
 		break;
 	default:
 		wpa_printf(MSG_INFO, "DFS chan_width %d not supported",
@@ -828,10 +830,10 @@ int hostapd_handle_dfs(struct hostapd_iface *iface)
 
 	/* Finally start CAC */
 	hostapd_set_state(iface, HAPD_IFACE_DFS);
-	wpa_printf(MSG_DEBUG, "DFS start CAC on %d MHz", iface->freq);
+	wpa_printf(MSG_DEBUG, "DFS start CAC on %d KHz", iface->freq);
 	wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START
-		"freq=%d chan=%d sec_chan=%d, width=%d, seg0=%d, seg1=%d, cac_time=%ds",
-		iface->freq,
+		"freq=%g chan=%d sec_chan=%d, width=%d, seg0=%d, seg1=%d, cac_time=%ds",
+		PR_KHZ(iface->freq),
 		iface->conf->channel, iface->conf->secondary_channel,
 		hostapd_get_oper_chwidth(iface->conf),
 		hostapd_get_oper_centr_freq_seg0_idx(iface->conf),
@@ -878,8 +880,9 @@ int hostapd_dfs_complete_cac(struct hostapd_iface *iface, int success, int freq,
 			     int cf1, int cf2)
 {
 	wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_COMPLETED
-		"success=%d freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d",
-		success, freq, ht_enabled, chan_offset, chan_width, cf1, cf2);
+		"success=%d freq=%g ht_enabled=%d chan_offset=%d chan_width=%d cf1=%g cf2=%g",
+		success, PR_KHZ(freq), ht_enabled, chan_offset, chan_width,
+		PR_KHZ(cf1), PR_KHZ(cf2));
 
 	if (success) {
 		/* Complete iface/ap configuration */
@@ -920,8 +923,9 @@ int hostapd_dfs_pre_cac_expired(struct hostapd_iface *iface, int freq,
 				int cf1, int cf2)
 {
 	wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_PRE_CAC_EXPIRED
-		"freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d",
-		freq, ht_enabled, chan_offset, chan_width, cf1, cf2);
+		"freq=%g ht_enabled=%d chan_offset=%d chan_width=%d cf1=%g cf2=%g",
+		PR_KHZ(freq), ht_enabled, chan_offset, chan_width, PR_KHZ(cf1),
+		PR_KHZ(cf2));
 
 	/* Proceed only if DFS is not offloaded to the driver */
 	if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD)
@@ -999,7 +1003,7 @@ static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface)
 	wpa_printf(MSG_DEBUG, "DFS will switch to a new channel %d",
 		   channel->chan);
 	wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NEW_CHANNEL
-		"freq=%d chan=%d sec_chan=%d", channel->freq,
+		"freq=%g chan=%d sec_chan=%d", PR_KHZ(channel->freq),
 		channel->chan, secondary_channel);
 
 	iface->freq = channel->freq;
@@ -1086,7 +1090,7 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
 	wpa_printf(MSG_DEBUG, "DFS will switch to a new channel %d",
 		   channel->chan);
 	wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NEW_CHANNEL
-		"freq=%d chan=%d sec_chan=%d", channel->freq,
+		"freq=%g chan=%d sec_chan=%d", PR_KHZ(channel->freq),
 		channel->chan, secondary_channel);
 
 	new_vht_oper_chwidth = iface->conf->vht_oper_chwidth;
@@ -1156,8 +1160,9 @@ int hostapd_dfs_radar_detected(struct hostapd_iface *iface, int freq,
 	int res;
 
 	wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_RADAR_DETECTED
-		"freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d",
-		freq, ht_enabled, chan_offset, chan_width, cf1, cf2);
+		"freq=%g ht_enabled=%d chan_offset=%d chan_width=%d cf1=%g cf2=%g",
+		PR_KHZ(freq), ht_enabled, chan_offset, chan_width, PR_KHZ(cf1),
+		PR_KHZ(cf2));
 
 	/* Proceed only if DFS is not offloaded to the driver */
 	if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD)
@@ -1189,8 +1194,9 @@ int hostapd_dfs_nop_finished(struct hostapd_iface *iface, int freq,
 			     int cf1, int cf2)
 {
 	wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NOP_FINISHED
-		"freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d",
-		freq, ht_enabled, chan_offset, chan_width, cf1, cf2);
+		"freq=%g ht_enabled=%d chan_offset=%d chan_width=%d cf1=%g cf2=%g",
+		PR_KHZ(freq), ht_enabled, chan_offset, chan_width, PR_KHZ(cf1),
+		PR_KHZ(cf2));
 
 	/* Proceed only if DFS is not offloaded to the driver */
 	if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD)
@@ -1244,10 +1250,10 @@ int hostapd_dfs_start_cac(struct hostapd_iface *iface, int freq,
 	/* TODO: How to check CAC time for ETSI weather channels? */
 	iface->dfs_cac_ms = 60000;
 	wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START
-		"freq=%d chan=%d chan_offset=%d width=%d seg0=%d "
-		"seg1=%d cac_time=%ds",
-		freq, (freq - 5000) / 5, chan_offset, chan_width, cf1, cf2,
-		iface->dfs_cac_ms / 1000);
+		"freq=%g chan=%d chan_offset=%d width=%d seg0=%g "
+		"seg1=%g cac_time=%ds",
+		PR_KHZ(freq), (MHZ(freq) - 5000) / 5, chan_offset, chan_width,
+		PR_KHZ(cf1), PR_KHZ(cf2), iface->dfs_cac_ms / 1000);
 	iface->cac_started = 1;
 	os_get_reltime(&iface->dfs_cac_start);
 	return 0;
@@ -1308,17 +1314,17 @@ int hostapd_is_dfs_overlap(struct hostapd_iface *iface, enum chan_width width,
 	switch (width) {
 	case CHAN_WIDTH_20_NOHT:
 	case CHAN_WIDTH_20:
-		half_width = 10;
+		half_width = KHZ(10);
 		break;
 	case CHAN_WIDTH_40:
-		half_width = 20;
+		half_width = KHZ(20);
 		break;
 	case CHAN_WIDTH_80:
 	case CHAN_WIDTH_80P80:
-		half_width = 40;
+		half_width = KHZ(40);
 		break;
 	case CHAN_WIDTH_160:
-		half_width = 80;
+		half_width = KHZ(80);
 		break;
 	default:
 		wpa_printf(MSG_WARNING, "DFS chanwidth %d not supported",
@@ -1337,8 +1343,9 @@ int hostapd_is_dfs_overlap(struct hostapd_iface *iface, enum chan_width width,
 			res++;
 	}
 
-	wpa_printf(MSG_DEBUG, "DFS: (%d, %d): in range: %s",
-		   center_freq - half_width, center_freq + half_width,
+	wpa_printf(MSG_DEBUG, "DFS: (%g, %g): in range: %s",
+		   PR_KHZ(center_freq - half_width),
+		   PR_KHZ(center_freq + half_width),
 		   res ? "yes" : "no");
 
 	return res;
diff --git a/src/ap/dpp_hostapd.c b/src/ap/dpp_hostapd.c
index 178fd126ec04..14d373ac8f23 100644
--- a/src/ap/dpp_hostapd.c
+++ b/src/ap/dpp_hostapd.c
@@ -54,8 +54,8 @@ int hostapd_dpp_qr_code(struct hostapd_data *hapd, const char *cmd)
 		wpa_printf(MSG_DEBUG,
 			   "DPP: Sending out pending authentication response");
 		wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR
-			" freq=%u type=%d",
-			MAC2STR(auth->peer_mac_addr), auth->curr_freq,
+			" freq=%g type=%d",
+			MAC2STR(auth->peer_mac_addr), PR_KHZ(auth->curr_freq),
 			DPP_PA_AUTHENTICATION_RESP);
 		hostapd_drv_send_action(hapd, auth->curr_freq, 0,
 					auth->peer_mac_addr,
@@ -162,8 +162,8 @@ static void hostapd_dpp_auth_resp_retry_timeout(void *eloop_ctx,
 	wpa_printf(MSG_DEBUG,
 		   "DPP: Retry Authentication Response after timeout");
 	wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR
-		" freq=%u type=%d",
-		MAC2STR(auth->peer_mac_addr), auth->curr_freq,
+		" freq=%g type=%d",
+		MAC2STR(auth->peer_mac_addr), PR_KHZ(auth->curr_freq),
 		DPP_PA_AUTHENTICATION_RESP);
 	hostapd_drv_send_action(hapd, auth->curr_freq, 500, auth->peer_mac_addr,
 				wpabuf_head(auth->resp_msg),
@@ -279,17 +279,18 @@ void hostapd_dpp_tx_status(struct hostapd_data *hapd, const u8 *dst,
 	if (!hapd->dpp_auth_ok_on_ack && hapd->dpp_auth->neg_freq > 0 &&
 	    hapd->dpp_auth->curr_freq != hapd->dpp_auth->neg_freq) {
 		wpa_printf(MSG_DEBUG,
-			   "DPP: Move from curr_freq %u MHz to neg_freq %u MHz for response",
-			   hapd->dpp_auth->curr_freq,
-			   hapd->dpp_auth->neg_freq);
+			   "DPP: Move from curr_freq %g MHz to neg_freq %g MHz for response",
+			   PR_KHZ(hapd->dpp_auth->curr_freq),
+			   PR_KHZ(hapd->dpp_auth->neg_freq));
 		hostapd_drv_send_action_cancel_wait(hapd);
 
 		if (hapd->dpp_auth->neg_freq !=
 		    (unsigned int) hapd->iface->freq && hapd->iface->freq > 0) {
 			/* TODO: Listen operation on non-operating channel */
 			wpa_printf(MSG_INFO,
-				   "DPP: Listen operation on non-operating channel (%d MHz) is not yet supported (operating channel: %d MHz)",
-				   hapd->dpp_auth->neg_freq, hapd->iface->freq);
+				   "DPP: Listen operation on non-operating channel (%g MHz) is not yet supported (operating channel: %g MHz)",
+				   PR_KHZ(hapd->dpp_auth->neg_freq),
+				   PR_KHZ(hapd->iface->freq));
 		}
 	}
 
@@ -354,15 +355,15 @@ static void hostapd_dpp_reply_wait_timeout(void *eloop_ctx, void *timeout_ctx)
 	if (auth->neg_freq > 0)
 		freq = auth->neg_freq;
 	wpa_printf(MSG_DEBUG,
-		   "DPP: Continue reply wait on channel %u MHz for %u ms",
-		   freq, wait_time);
+		   "DPP: Continue reply wait on channel %g MHz for %u ms",
+		   PR_KHZ(freq), wait_time);
 	hapd->dpp_in_response_listen = 1;
 
 	if (freq != (unsigned int) hapd->iface->freq && hapd->iface->freq > 0) {
 		/* TODO: Listen operation on non-operating channel */
 		wpa_printf(MSG_INFO,
-			   "DPP: Listen operation on non-operating channel (%d MHz) is not yet supported (operating channel: %d MHz)",
-			   freq, hapd->iface->freq);
+			   "DPP: Listen operation on non-operating channel (%g MHz) is not yet supported (operating channel: %g MHz)",
+			   PR_KHZ(freq), PR_KHZ(hapd->iface->freq));
 	}
 
 	eloop_register_timeout(wait_time / 1000, (wait_time % 1000) * 1000,
@@ -471,12 +472,12 @@ static int hostapd_dpp_auth_init_next(struct hostapd_data *hapd)
 	wait_time -= 10;
 	if (auth->neg_freq > 0 && freq != auth->neg_freq) {
 		wpa_printf(MSG_DEBUG,
-			   "DPP: Initiate on %u MHz and move to neg_freq %u MHz for response",
-			   freq, auth->neg_freq);
+			   "DPP: Initiate on %g MHz and move to neg_freq %g MHz for response",
+			   PR_KHZ(freq), PR_KHZ(auth->neg_freq));
 	}
 	wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR
-		" freq=%u type=%d",
-		MAC2STR(dst), freq, DPP_PA_AUTHENTICATION_REQ);
+		" freq=%g type=%d",
+		MAC2STR(dst), PR_KHZ(freq), DPP_PA_AUTHENTICATION_REQ);
 	auth->auth_req_ack = 0;
 	os_get_reltime(&hapd->dpp_last_init);
 	return hostapd_drv_send_action(hapd, freq, wait_time,
@@ -539,7 +540,7 @@ int hostapd_dpp_auth_init(struct hostapd_data *hapd, const char *cmd)
 
 	pos = os_strstr(cmd, " neg_freq=");
 	if (pos)
-		neg_freq = atoi(pos + 10);
+		neg_freq = KHZ(atof(pos + 10));
 
 	if (hapd->dpp_auth) {
 		eloop_cancel_timeout(hostapd_dpp_init_timeout, hapd, NULL);
@@ -585,7 +586,7 @@ int hostapd_dpp_listen(struct hostapd_data *hapd, const char *cmd)
 {
 	int freq;
 
-	freq = atoi(cmd);
+	freq = KHZ(atof(cmd));
 	if (freq <= 0)
 		return -1;
 
@@ -601,8 +602,8 @@ int hostapd_dpp_listen(struct hostapd_data *hapd, const char *cmd)
 	if (freq != hapd->iface->freq && hapd->iface->freq > 0) {
 		/* TODO: Listen operation on non-operating channel */
 		wpa_printf(MSG_INFO,
-			   "DPP: Listen operation on non-operating channel (%d MHz) is not yet supported (operating channel: %d MHz)",
-			   freq, hapd->iface->freq);
+			   "DPP: Listen operation on non-operating channel (%g MHz) is not yet supported (operating channel: %g MHz)",
+			   PR_KHZ(freq), PR_KHZ(hapd->iface->freq));
 		return -1;
 	}
 
@@ -697,8 +698,8 @@ static void hostapd_dpp_rx_auth_req(struct hostapd_data *hapd, const u8 *src,
 	os_memcpy(hapd->dpp_auth->peer_mac_addr, src, ETH_ALEN);
 
 	wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR
-		" freq=%u type=%d",
-		MAC2STR(src), hapd->dpp_auth->curr_freq,
+		" freq=%g type=%d",
+		MAC2STR(src), PR_KHZ(hapd->dpp_auth->curr_freq),
 		DPP_PA_AUTHENTICATION_RESP);
 	hostapd_drv_send_action(hapd, hapd->dpp_auth->curr_freq, 0,
 				src, wpabuf_head(hapd->dpp_auth->resp_msg),
@@ -874,8 +875,8 @@ fail:
 			goto fail2;
 
 		wpa_msg(hapd->msg_ctx, MSG_INFO,
-			DPP_EVENT_TX "dst=" MACSTR " freq=%u type=%d",
-			MAC2STR(addr), auth->curr_freq,
+			DPP_EVENT_TX "dst=" MACSTR " freq=%g type=%d",
+			MAC2STR(addr), PR_KHZ(auth->curr_freq),
 			DPP_PA_CONFIGURATION_RESULT);
 		hostapd_drv_send_action(hapd, auth->curr_freq, 0,
 					addr, wpabuf_head(msg),
@@ -908,8 +909,8 @@ static void hostapd_dpp_start_gas_client(struct hostapd_data *hapd)
 		return;
 	}
 
-	wpa_printf(MSG_DEBUG, "DPP: GAS request to " MACSTR " (freq %u MHz)",
-		   MAC2STR(auth->peer_mac_addr), auth->curr_freq);
+	wpa_printf(MSG_DEBUG, "DPP: GAS request to " MACSTR " (freq %g MHz)",
+		   MAC2STR(auth->peer_mac_addr), PR_KHZ(auth->curr_freq));
 
 	res = gas_query_ap_req(hapd->gas, auth->peer_mac_addr, auth->curr_freq,
 			       buf, hostapd_dpp_gas_resp_cb, hapd);
@@ -990,7 +991,7 @@ static void hostapd_dpp_rx_auth_resp(struct hostapd_data *hapd, const u8 *src,
 	os_memcpy(auth->peer_mac_addr, src, ETH_ALEN);
 
 	wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR
-		" freq=%u type=%d", MAC2STR(src), auth->curr_freq,
+		" freq=%g type=%d", MAC2STR(src), PR_KHZ(auth->curr_freq),
 		DPP_PA_AUTHENTICATION_CONF);
 	hostapd_drv_send_action(hapd, auth->curr_freq, 0, src,
 				wpabuf_head(msg), wpabuf_len(msg));
@@ -1452,7 +1453,7 @@ skip_connector:
 	wpa_printf(MSG_DEBUG, "DPP: Send Peer Discovery Response to " MACSTR
 		   " status=%d", MAC2STR(src), status);
 	wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR
-		" freq=%u type=%d status=%d", MAC2STR(src), freq,
+		" freq=%g type=%d status=%d", MAC2STR(src), PR_KHZ(freq),
 		DPP_PA_PEER_DISCOVERY_RESP, status);
 	hostapd_drv_send_action(hapd, freq, 0, src,
 				wpabuf_head(msg), wpabuf_len(msg));
@@ -1591,7 +1592,7 @@ hostapd_dpp_rx_pkex_exchange_req(struct hostapd_data *hapd, const u8 *src,
 
 	msg = hapd->dpp_pkex->exchange_resp;
 	wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR
-		" freq=%u type=%d", MAC2STR(src), freq,
+		" freq=%g type=%d", MAC2STR(src), PR_KHZ(freq),
 		DPP_PA_PKEX_EXCHANGE_RESP);
 	hostapd_drv_send_action(hapd, freq, 0, src,
 				wpabuf_head(msg), wpabuf_len(msg));
@@ -1634,7 +1635,7 @@ hostapd_dpp_rx_pkex_exchange_resp(struct hostapd_data *hapd, const u8 *src,
 		   MAC2STR(src));
 
 	wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR
-		" freq=%u type=%d", MAC2STR(src), freq,
+		" freq=%g type=%d", MAC2STR(src), PR_KHZ(freq),
 		DPP_PA_PKEX_COMMIT_REVEAL_REQ);
 	hostapd_drv_send_action(hapd, freq, 0, src,
 				wpabuf_head(msg), wpabuf_len(msg));
@@ -1677,7 +1678,7 @@ hostapd_dpp_rx_pkex_commit_reveal_req(struct hostapd_data *hapd, const u8 *src,
 		   MACSTR, MAC2STR(src));
 
 	wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR
-		" freq=%u type=%d", MAC2STR(src), freq,
+		" freq=%g type=%d", MAC2STR(src), PR_KHZ(freq),
 		DPP_PA_PKEX_COMMIT_REVEAL_RESP);
 	hostapd_drv_send_action(hapd, freq, 0, src,
 				wpabuf_head(msg), wpabuf_len(msg));
@@ -1754,25 +1755,25 @@ void hostapd_dpp_rx_action(struct hostapd_data *hapd, const u8 *src,
 
 	wpa_printf(MSG_DEBUG,
 		   "DPP: Received DPP Public Action frame crypto suite %u type %d from "
-		   MACSTR " freq=%u",
-		   crypto_suite, type, MAC2STR(src), freq);
+		   MACSTR " freq=%g",
+		   crypto_suite, type, MAC2STR(src), PR_KHZ(freq));
 	if (crypto_suite != 1) {
 		wpa_printf(MSG_DEBUG, "DPP: Unsupported crypto suite %u",
 			   crypto_suite);
 		wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_RX "src=" MACSTR
-			" freq=%u type=%d ignore=unsupported-crypto-suite",
-			MAC2STR(src), freq, type);
+			" freq=%g type=%d ignore=unsupported-crypto-suite",
+			MAC2STR(src), PR_KHZ(freq), type);
 		return;
 	}
 	wpa_hexdump(MSG_MSGDUMP, "DPP: Received message attributes", buf, len);
 	if (dpp_check_attrs(buf, len) < 0) {
 		wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_RX "src=" MACSTR
-			" freq=%u type=%d ignore=invalid-attributes",
-			MAC2STR(src), freq, type);
+			" freq=%g type=%d ignore=invalid-attributes",
+			MAC2STR(src), PR_KHZ(freq), type);
 		return;
 	}
 	wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_RX "src=" MACSTR
-		" freq=%u type=%d", MAC2STR(src), freq, type);
+		" freq=%g type=%d", MAC2STR(src), PR_KHZ(freq), type);
 
 #ifdef CONFIG_DPP2
 	if (dpp_relay_rx_action(hapd->iface->interfaces->dpp,
@@ -2002,9 +2003,9 @@ int hostapd_dpp_pkex_add(struct hostapd_data *hapd, const char *cmd)
 		msg = hapd->dpp_pkex->exchange_req;
 		/* TODO: Which channel to use? */
 		wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR
-			" freq=%u type=%d", MAC2STR(broadcast), 2437,
+			" freq=%g type=%d", MAC2STR(broadcast), (float)2437,
 			DPP_PA_PKEX_EXCHANGE_REQ);
-		hostapd_drv_send_action(hapd, 2437, 0, broadcast,
+		hostapd_drv_send_action(hapd, KHZ(2437), 0, broadcast,
 					wpabuf_head(msg), wpabuf_len(msg));
 	}
 
@@ -2064,8 +2065,8 @@ static void hostapd_dpp_relay_tx(void *ctx, const u8 *addr, unsigned int freq,
 	struct hostapd_data *hapd = ctx;
 	u8 *buf;
 
-	wpa_printf(MSG_DEBUG, "DPP: Send action frame dst=" MACSTR " freq=%u",
-		   MAC2STR(addr), freq);
+	wpa_printf(MSG_DEBUG, "DPP: Send action frame dst=" MACSTR " freq=%g",
+		   MAC2STR(addr), PR_KHZ(freq));
 	buf = os_malloc(2 + len);
 	if (!buf)
 		return;
@@ -2235,7 +2236,7 @@ hostapd_dpp_chirp_scan_res_handler(struct hostapd_iface *iface)
 	}
 
 	/* Preferred chirping channels */
-	int_array_add_unique(&hapd->dpp_chirp_freqs, 2437);
+	int_array_add_unique(&hapd->dpp_chirp_freqs, KHZ(2437));
 
 	mode = dpp_get_mode(hapd, HOSTAPD_MODE_IEEE80211A);
 	if (mode) {
@@ -2247,15 +2248,15 @@ hostapd_dpp_chirp_scan_res_handler(struct hostapd_iface *iface)
 			if (chan->flag & (HOSTAPD_CHAN_DISABLED |
 					  HOSTAPD_CHAN_RADAR))
 				continue;
-			if (chan->freq == 5220)
+			if (chan->freq == KHZ(5220))
 				chan44 = 1;
-			if (chan->freq == 5745)
+			if (chan->freq == KHZ(5745))
 				chan149 = 1;
 		}
 		if (chan149)
-			int_array_add_unique(&hapd->dpp_chirp_freqs, 5745);
+			int_array_add_unique(&hapd->dpp_chirp_freqs, KHZ(5745));
 		else if (chan44)
-			int_array_add_unique(&hapd->dpp_chirp_freqs, 5220);
+			int_array_add_unique(&hapd->dpp_chirp_freqs, KHZ(5220));
 	}
 
 	mode = dpp_get_mode(hapd, HOSTAPD_MODE_IEEE80211AD);
@@ -2265,9 +2266,9 @@ hostapd_dpp_chirp_scan_res_handler(struct hostapd_iface *iface)
 
 			if ((chan->flag & (HOSTAPD_CHAN_DISABLED |
 					   HOSTAPD_CHAN_RADAR)) ||
-			    chan->freq != 60480)
+			    chan->freq != KHZ(60480))
 				continue;
-			int_array_add_unique(&hapd->dpp_chirp_freqs, 60480);
+			int_array_add_unique(&hapd->dpp_chirp_freqs, KHZ(60480));
 			break;
 		}
 	}
@@ -2334,8 +2335,8 @@ static void hostapd_dpp_chirp_next(void *eloop_ctx, void *timeout_ctx)
 				break;
 		if (!hapd->dpp_chirp_freqs[i]) {
 			wpa_printf(MSG_DEBUG,
-				   "DPP: Previous chirp freq %d not found",
-				   hapd->dpp_chirp_freq);
+				   "DPP: Previous chirp freq %g not found",
+				   PR_KHZ(hapd->dpp_chirp_freq));
 			return;
 		}
 		i++;
diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c
index 36678e7a31f3..d04909fbee6e 100644
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -851,10 +851,11 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
 
 	hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
 		       HOSTAPD_LEVEL_INFO,
-		       "driver %s channel switch: freq=%d, ht=%d, vht_ch=0x%x, offset=%d, width=%d (%s), cf1=%d, cf2=%d",
+		       "driver %s channel switch: freq=%g, ht=%d, vht_ch=0x%x, offset=%d, width=%d (%s), cf1=%g, cf2=%g",
 		       finished ? "had" : "starting",
-		       freq, ht, hapd->iconf->ch_switch_vht_config, offset,
-		       width, channel_width_to_string(width), cf1, cf2);
+		       PR_KHZ(freq), ht, hapd->iconf->ch_switch_vht_config,
+		       offset, width, channel_width_to_string(width),
+		       PR_KHZ(cf1), PR_KHZ(cf2));
 
 	if (!hapd->iface->current_mode) {
 		hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
@@ -893,10 +894,10 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
 
 	switch (hapd->iface->current_mode->mode) {
 	case HOSTAPD_MODE_IEEE80211A:
-		if (cf1 > 5000)
-			seg0_idx = (cf1 - 5000) / 5;
-		if (cf2 > 5000)
-			seg1_idx = (cf2 - 5000) / 5;
+		if (MHZ(cf1) > 5000)
+			seg0_idx = (MHZ(cf1) - 5000) / 5;
+		if (MHZ(cf2) > 5000)
+			seg1_idx = (MHZ(cf2) - 5000) / 5;
 		break;
 	default:
 		ieee80211_freq_to_chan(cf1, &seg0_idx);
@@ -928,11 +929,11 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
 				  hapd->iface->num_hw_features);
 
 	wpa_msg(hapd->msg_ctx, MSG_INFO,
-		"%sfreq=%d ht_enabled=%d ch_offset=%d ch_width=%s cf1=%d cf2=%d dfs=%d",
+		"%sfreq=%g ht_enabled=%d ch_offset=%d ch_width=%s cf1=%g cf2=%g dfs=%d",
 		finished ? WPA_EVENT_CHANNEL_SWITCH :
 		WPA_EVENT_CHANNEL_SWITCH_STARTED,
-		freq, ht, offset, channel_width_to_string(width),
-		cf1, cf2, is_dfs);
+		PR_KHZ(freq), ht, offset, channel_width_to_string(width),
+		PR_KHZ(cf1), PR_KHZ(cf2), is_dfs);
 	if (!finished)
 		return;
 
@@ -942,10 +943,10 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
 		ieee802_11_set_beacon(hapd);
 
 		wpa_msg(hapd->msg_ctx, MSG_INFO, AP_CSA_FINISHED
-			"freq=%d dfs=%d", freq, is_dfs);
+			"freq=%g dfs=%d", PR_KHZ(freq), is_dfs);
 	} else if (hapd->iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) {
 		wpa_msg(hapd->msg_ctx, MSG_INFO, AP_CSA_FINISHED
-			"freq=%d dfs=%d", freq, is_dfs);
+			"freq=%g dfs=%d", PR_KHZ(freq), is_dfs);
 	} else if (is_dfs &&
 		   hostapd_is_dfs_required(hapd->iface) &&
 		   !hostapd_is_dfs_chan_available(hapd->iface) &&
@@ -1567,8 +1568,8 @@ static void hostapd_single_channel_get_survey(struct hostapd_iface *iface,
 		return;
 
 	wpa_printf(MSG_DEBUG,
-		   "Single Channel Survey: (freq=%d channel_time=%ld channel_time_busy=%ld)",
-		   survey->freq,
+		   "Single Channel Survey: (freq=%g channel_time=%ld channel_time_busy=%ld)",
+		   PR_KHZ(survey->freq),
 		   (unsigned long int) survey->channel_time,
 		   (unsigned long int) survey->channel_time_busy);
 
@@ -1641,7 +1642,7 @@ static void hostapd_event_iface_unavailable(struct hostapd_data *hapd)
 static void hostapd_event_dfs_radar_detected(struct hostapd_data *hapd,
 					     struct dfs_event *radar)
 {
-	wpa_printf(MSG_DEBUG, "DFS radar detected on %d MHz", radar->freq);
+	wpa_printf(MSG_DEBUG, "DFS radar detected on %d MHz", MHZ(radar->freq));
 	hostapd_dfs_radar_detected(hapd->iface, radar->freq, radar->ht_enabled,
 				   radar->chan_offset, radar->chan_width,
 				   radar->cf1, radar->cf2);
@@ -1651,7 +1652,7 @@ static void hostapd_event_dfs_radar_detected(struct hostapd_data *hapd,
 static void hostapd_event_dfs_pre_cac_expired(struct hostapd_data *hapd,
 					      struct dfs_event *radar)
 {
-	wpa_printf(MSG_DEBUG, "DFS Pre-CAC expired on %d MHz", radar->freq);
+	wpa_printf(MSG_DEBUG, "DFS Pre-CAC expired on %d MHz", MHZ(radar->freq));
 	hostapd_dfs_pre_cac_expired(hapd->iface, radar->freq, radar->ht_enabled,
 				    radar->chan_offset, radar->chan_width,
 				    radar->cf1, radar->cf2);
@@ -1661,7 +1662,7 @@ static void hostapd_event_dfs_pre_cac_expired(struct hostapd_data *hapd,
 static void hostapd_event_dfs_cac_finished(struct hostapd_data *hapd,
 					   struct dfs_event *radar)
 {
-	wpa_printf(MSG_DEBUG, "DFS CAC finished on %d MHz", radar->freq);
+	wpa_printf(MSG_DEBUG, "DFS CAC finished on %d MHz", MHZ(radar->freq));
 	hostapd_dfs_complete_cac(hapd->iface, 1, radar->freq, radar->ht_enabled,
 				 radar->chan_offset, radar->chan_width,
 				 radar->cf1, radar->cf2);
@@ -1671,7 +1672,7 @@ static void hostapd_event_dfs_cac_finished(struct hostapd_data *hapd,
 static void hostapd_event_dfs_cac_aborted(struct hostapd_data *hapd,
 					  struct dfs_event *radar)
 {
-	wpa_printf(MSG_DEBUG, "DFS CAC aborted on %d MHz", radar->freq);
+	wpa_printf(MSG_DEBUG, "DFS CAC aborted on %d MHz", MHZ(radar->freq));
 	hostapd_dfs_complete_cac(hapd->iface, 0, radar->freq, radar->ht_enabled,
 				 radar->chan_offset, radar->chan_width,
 				 radar->cf1, radar->cf2);
@@ -1681,7 +1682,7 @@ static void hostapd_event_dfs_cac_aborted(struct hostapd_data *hapd,
 static void hostapd_event_dfs_nop_finished(struct hostapd_data *hapd,
 					   struct dfs_event *radar)
 {
-	wpa_printf(MSG_DEBUG, "DFS NOP finished on %d MHz", radar->freq);
+	wpa_printf(MSG_DEBUG, "DFS NOP finished on %d MHz", MHZ(radar->freq));
 	hostapd_dfs_nop_finished(hapd->iface, radar->freq, radar->ht_enabled,
 				 radar->chan_offset, radar->chan_width,
 				 radar->cf1, radar->cf2);
@@ -1691,7 +1692,7 @@ static void hostapd_event_dfs_nop_finished(struct hostapd_data *hapd,
 static void hostapd_event_dfs_cac_started(struct hostapd_data *hapd,
 					  struct dfs_event *radar)
 {
-	wpa_printf(MSG_DEBUG, "DFS offload CAC started on %d MHz", radar->freq);
+	wpa_printf(MSG_DEBUG, "DFS offload CAC started on %d MHz", MHZ(radar->freq));
 	hostapd_dfs_start_cac(hapd->iface, radar->freq, radar->ht_enabled,
 			      radar->chan_offset, radar->chan_width,
 			      radar->cf1, radar->cf2);
diff --git a/src/ap/gas_query_ap.c b/src/ap/gas_query_ap.c
index fdb3cad55ade..125f38c4c848 100644
--- a/src/ap/gas_query_ap.c
+++ b/src/ap/gas_query_ap.c
@@ -144,8 +144,8 @@ static void gas_query_done(struct gas_query_ap *gas,
 			   enum gas_query_ap_result result)
 {
 	wpa_msg(gas->msg_ctx, MSG_INFO, GAS_QUERY_DONE "addr=" MACSTR
-		" dialog_token=%u freq=%d status_code=%u result=%s",
-		MAC2STR(query->addr), query->dialog_token, query->freq,
+		" dialog_token=%u freq=%g status_code=%u result=%s",
+		MAC2STR(query->addr), query->dialog_token, PR_KHZ(query->freq),
 		query->status_code, gas_result_txt(result));
 	if (gas->current == query)
 		gas->current = NULL;
@@ -262,9 +262,9 @@ static int gas_query_tx(struct gas_query_ap *gas,
 	int res, prot = pmf_in_use(gas->hapd, query->addr);
 
 	wpa_printf(MSG_DEBUG, "GAS: Send action frame to " MACSTR " len=%u "
-		   "freq=%d prot=%d using src addr " MACSTR,
+		   "freq=%g prot=%d using src addr " MACSTR,
 		   MAC2STR(query->addr), (unsigned int) wpabuf_len(req),
-		   query->freq, prot, MAC2STR(query->sa));
+		   PR_KHZ(query->freq), prot, MAC2STR(query->sa));
 	if (prot) {
 		u8 *categ = wpabuf_mhead_u8(req);
 		*categ = WLAN_ACTION_PROTECTED_DUAL;
@@ -705,8 +705,8 @@ int gas_query_ap_req(struct gas_query_ap *gas, const u8 *dst, int freq,
 	*(wpabuf_mhead_u8(req) + 2) = dialog_token;
 
 	wpa_msg(gas->msg_ctx, MSG_INFO, GAS_QUERY_START "addr=" MACSTR
-		" dialog_token=%u freq=%d",
-		MAC2STR(query->addr), query->dialog_token, query->freq);
+		" dialog_token=%u freq=%g",
+		MAC2STR(query->addr), query->dialog_token, PR_KHZ(query->freq));
 
 	gas_query_tx_initial_req(gas, query);
 
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index b37f49f9a8ec..22cc5792c4c9 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -1985,9 +1985,9 @@ static int hostapd_setup_interface_complete_sync(struct hostapd_iface *iface,
 #endif /* NEED_AP_MLME */
 
 		wpa_printf(MSG_DEBUG, "Mode: %s  Channel: %d  "
-			   "Frequency: %d MHz",
+			   "Frequency: %g MHz",
 			   hostapd_hw_mode_txt(iface->conf->hw_mode),
-			   iface->conf->channel, iface->freq);
+			   iface->conf->channel, PR_KHZ(iface->freq));
 
 #ifdef NEED_AP_MLME
 		/* Handle DFS only if it is not offloaded to the driver */
@@ -3434,10 +3434,8 @@ static int hostapd_change_config_freq(struct hostapd_data *hapd,
 	conf->channel = channel;
 	conf->ieee80211n = params->ht_enabled;
 	conf->secondary_channel = params->sec_channel_offset;
-	ieee80211_freq_to_chan(params->center_freq1,
-			       &seg0);
-	ieee80211_freq_to_chan(params->center_freq2,
-			       &seg1);
+	ieee80211_freq_to_chan(params->center_freq1, &seg0);
+	ieee80211_freq_to_chan(params->center_freq2, &seg1);
 	hostapd_set_oper_centr_freq_seg0_idx(conf, seg0);
 	hostapd_set_oper_centr_freq_seg1_idx(conf, seg1);
 
@@ -3481,8 +3479,8 @@ static int hostapd_fill_csa_settings(struct hostapd_data *hapd,
 		    &hapd->iface->cs_oper_class,
 		    &chan) == NUM_HOSTAPD_MODES) {
 		wpa_printf(MSG_DEBUG,
-			   "invalid frequency for channel switch (freq=%d, sec_channel_offset=%d, vht_enabled=%d, he_enabled=%d)",
-			   settings->freq_params.freq,
+			   "invalid frequency for channel switch (freq=%g, sec_channel_offset=%d, vht_enabled=%d, he_enabled=%d)",
+			   PR_KHZ(settings->freq_params.freq),
 			   settings->freq_params.sec_channel_offset,
 			   settings->freq_params.vht_enabled,
 			   settings->freq_params.he_enabled);
@@ -3590,9 +3588,9 @@ hostapd_switch_channel_fallback(struct hostapd_iface *iface,
 	wpa_printf(MSG_DEBUG, "Restarting all CSA-related BSSes");
 
 	if (freq_params->center_freq1)
-		seg0_idx = 36 + (freq_params->center_freq1 - 5180) / 5;
+		seg0_idx = 36 + (MHZ(freq_params->center_freq1) - 5180) / 5;
 	if (freq_params->center_freq2)
-		seg1_idx = 36 + (freq_params->center_freq2 - 5180) / 5;
+		seg1_idx = 36 + (MHZ(freq_params->center_freq2) - 5180) / 5;
 
 	switch (freq_params->bandwidth) {
 	case 0:
diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
index f6e69030d767..184156af41e7 100644
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -132,10 +132,10 @@ int hostapd_get_hw_features(struct hostapd_iface *iface)
 				continue;
 
 			wpa_printf(MSG_MSGDUMP, "Allowed channel: mode=%d "
-				   "chan=%d freq=%d MHz max_tx_power=%d dBm%s",
+				   "chan=%d freq=%g MHz max_tx_power=%d dBm%s",
 				   feature->mode,
 				   feature->channels[j].chan,
-				   feature->channels[j].freq,
+				   PR_KHZ(feature->channels[j].freq),
 				   feature->channels[j].max_tx_power,
 				   dfs ? dfs_info(&feature->channels[j]) : "");
 		}
@@ -230,7 +230,7 @@ static int ieee80211n_allowed_ht40_channel_pair(struct hostapd_iface *iface)
 	struct hostapd_channel_data *p_chan, *s_chan;
 
 	pri_freq = iface->freq;
-	sec_freq = pri_freq + iface->conf->secondary_channel * 20;
+	sec_freq = pri_freq + KHZ(iface->conf->secondary_channel * 20);
 
 	if (!iface->current_mode)
 		return 0;
@@ -252,11 +252,11 @@ static void ieee80211n_switch_pri_sec(struct hostapd_iface *iface)
 {
 	if (iface->conf->secondary_channel > 0) {
 		iface->conf->channel += 4;
-		iface->freq += 20;
+		iface->freq += KHZ(20);
 		iface->conf->secondary_channel = -1;
 	} else {
 		iface->conf->channel -= 4;
-		iface->freq -= 20;
+		iface->freq -= KHZ(20);
 		iface->conf->secondary_channel = 1;
 	}
 }
@@ -270,7 +270,7 @@ static int ieee80211n_check_40mhz_5g(struct hostapd_iface *iface,
 	struct hostapd_channel_data *pri_chan, *sec_chan;
 
 	pri_freq = iface->freq;
-	sec_freq = pri_freq + iface->conf->secondary_channel * 20;
+	sec_freq = pri_freq + KHZ(iface->conf->secondary_channel * 20);
 
 	if (!iface->current_mode)
 		return 0;
@@ -377,18 +377,18 @@ static void ieee80211n_scan_channels_2g4(struct hostapd_iface *iface,
 
 	pri_freq = iface->freq;
 	if (iface->conf->secondary_channel > 0)
-		sec_freq = pri_freq + 20;
+		sec_freq = pri_freq + KHZ(20);
 	else
-		sec_freq = pri_freq - 20;
+		sec_freq = pri_freq - KHZ(20);
 	/*
 	 * Note: Need to find the PRI channel also in cases where the affected
 	 * channel is the SEC channel of a 40 MHz BSS, so need to include the
 	 * scanning coverage here to be 40 MHz from the center frequency.
 	 */
-	affected_start = (pri_freq + sec_freq) / 2 - 40;
-	affected_end = (pri_freq + sec_freq) / 2 + 40;
-	wpa_printf(MSG_DEBUG, "40 MHz affected channel range: [%d,%d] MHz",
-		   affected_start, affected_end);
+	affected_start = (pri_freq + sec_freq) / 2 - KHZ(40);
+	affected_end = (pri_freq + sec_freq) / 2 + KHZ(40);
+	wpa_printf(MSG_DEBUG, "40 MHz affected channel range: [%g,%g] MHz",
+		   PR_KHZ(affected_start), PR_KHZ(affected_end));
 
 	mode = iface->current_mode;
 	params->freqs = os_calloc(mode->num_channels + 1, sizeof(int));
@@ -422,14 +422,14 @@ static void ieee80211n_scan_channels_5g(struct hostapd_iface *iface,
 
 	pri_freq = iface->freq;
 	if (iface->conf->secondary_channel > 0) {
-		affected_start = pri_freq - 10;
-		affected_end = pri_freq + 30;
+		affected_start = pri_freq - KHZ(10);
+		affected_end = pri_freq + KHZ(30);
 	} else {
-		affected_start = pri_freq - 30;
-		affected_end = pri_freq + 10;
+		affected_start = pri_freq - KHZ(30);
+		affected_end = pri_freq + KHZ(10);
 	}
-	wpa_printf(MSG_DEBUG, "40 MHz affected channel range: [%d,%d] MHz",
-		   affected_start, affected_end);
+	wpa_printf(MSG_DEBUG, "40 MHz affected channel range: [%g,%g] MHz",
+		   PR_KHZ(affected_start), PR_KHZ(affected_end));
 
 	mode = iface->current_mode;
 	params->freqs = os_calloc(mode->num_channels + 1, sizeof(int));
@@ -750,8 +750,8 @@ static int hostapd_is_usable_chan(struct hostapd_iface *iface,
 		return 1;
 
 	wpa_printf(MSG_INFO,
-		   "Frequency %d (%s) not allowed for AP mode, flags: 0x%x%s%s",
-		   frequency, primary ? "primary" : "secondary",
+		   "Frequency %g (%s) not allowed for AP mode, flags: 0x%x%s%s",
+		   PR_KHZ(frequency), primary ? "primary" : "secondary",
 		   chan->flag,
 		   chan->flag & HOSTAPD_CHAN_NO_IR ? " NO-IR" : "",
 		   chan->flag & HOSTAPD_CHAN_RADAR ? " RADAR" : "");
@@ -855,20 +855,21 @@ static int hostapd_is_usable_chans(struct hostapd_iface *iface)
 		return 1;
 
 	if (hostapd_is_usable_chan(iface, iface->freq +
-				   iface->conf->secondary_channel * 20, 0))
+				   KHZ(iface->conf->secondary_channel * 20),
+				   0))
 		return 1;
 	if (!iface->conf->ht40_plus_minus_allowed)
 		return 0;
 
 	/* Both HT40+ and HT40- are set, pick a valid secondary channel */
-	secondary_freq = iface->freq + 20;
+	secondary_freq = iface->freq + KHZ(20);
 	if (hostapd_is_usable_chan(iface, secondary_freq, 0) &&
 	    (pri_chan->allowed_bw & HOSTAPD_CHAN_WIDTH_40P)) {
 		iface->conf->secondary_channel = 1;
 		return 1;
 	}
 
-	secondary_freq = iface->freq - 20;
+	secondary_freq = iface->freq - KHZ(20);
 	if (hostapd_is_usable_chan(iface, secondary_freq, 0) &&
 	    (pri_chan->allowed_bw & HOSTAPD_CHAN_WIDTH_40M)) {
 		iface->conf->secondary_channel = -1;
@@ -881,16 +882,16 @@ static int hostapd_is_usable_chans(struct hostapd_iface *iface)
 
 static void hostapd_determine_mode(struct hostapd_iface *iface)
 {
-	int i;
+	int i, freq = MHZ(iface->freq);
 	enum hostapd_hw_mode target_mode;
 
 	if (iface->current_mode ||
 	    iface->conf->hw_mode != HOSTAPD_MODE_IEEE80211ANY)
 		return;
 
-	if (iface->freq < 4000)
+	if (freq < 4000)
 		target_mode = HOSTAPD_MODE_IEEE80211G;
-	else if (iface->freq > 50000)
+	else if (freq > 50000)
 		target_mode = HOSTAPD_MODE_IEEE80211AD;
 	else
 		target_mode = HOSTAPD_MODE_IEEE80211A;
@@ -970,8 +971,8 @@ int hostapd_acs_completed(struct hostapd_iface *iface, int err)
 	switch (hostapd_check_chans(iface)) {
 	case HOSTAPD_CHAN_VALID:
 		wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO,
-			ACS_EVENT_COMPLETED "freq=%d channel=%d",
-			iface->freq, iface->conf->channel);
+			ACS_EVENT_COMPLETED "freq=%g channel=%d",
+			PR_KHZ(iface->freq), iface->conf->channel);
 		break;
 	case HOSTAPD_CHAN_ACS:
 		wpa_printf(MSG_ERROR, "ACS error - reported complete, but no result available");
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index b91640070f4f..ba984194c2ca 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -4685,9 +4685,10 @@ static int handle_action(struct hostapd_data *hapd,
 
 	action = (u8 *) &mgmt->u.action.u;
 	wpa_printf(MSG_DEBUG, "RX_ACTION category %u action %u sa " MACSTR
-		   " da " MACSTR " len %d freq %u",
+		   " da " MACSTR " len %d freq %g",
 		   mgmt->u.action.category, *action,
-		   MAC2STR(mgmt->sa), MAC2STR(mgmt->da), (int) len, freq);
+		   MAC2STR(mgmt->sa), MAC2STR(mgmt->da), (int) len,
+		   PR_KHZ(freq));
 
 	sta = ap_get_sta(hapd, mgmt->sa);
 
diff --git a/src/ap/ieee802_11_ht.c b/src/ap/ieee802_11_ht.c
index 59ecbdce7bf1..ab0474b661cd 100644
--- a/src/ap/ieee802_11_ht.c
+++ b/src/ap/ieee802_11_ht.c
@@ -180,7 +180,7 @@ static int is_40_allowed(struct hostapd_iface *iface, int channel)
 {
 	int pri_freq, sec_freq;
 	int affected_start, affected_end;
-	int pri = 2407 + 5 * channel;
+	int pri = KHZ(2407 + 5 * channel);
 
 	if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G)
 		return 1;
@@ -188,18 +188,18 @@ static int is_40_allowed(struct hostapd_iface *iface, int channel)
 	pri_freq = hostapd_hw_get_freq(iface->bss[0], iface->conf->channel);
 
 	if (iface->conf->secondary_channel > 0)
-		sec_freq = pri_freq + 20;
+		sec_freq = pri_freq + KHZ(20);
 	else
-		sec_freq = pri_freq - 20;
+		sec_freq = pri_freq - KHZ(20);
 
-	affected_start = (pri_freq + sec_freq) / 2 - 25;
-	affected_end = (pri_freq + sec_freq) / 2 + 25;
+	affected_start = (pri_freq + sec_freq) / 2 - KHZ(25);
+	affected_end = (pri_freq + sec_freq) / 2 + KHZ(25);
 	if ((pri < affected_start || pri > affected_end))
 		return 1; /* not within affected channel range */
 
-	wpa_printf(MSG_ERROR, "40 MHz affected channel range: [%d,%d] MHz",
-		   affected_start, affected_end);
-	wpa_printf(MSG_ERROR, "Neighboring BSS: freq=%d", pri);
+	wpa_printf(MSG_ERROR, "40 MHz affected channel range: [%g,%g] MHz",
+		   PR_KHZ(affected_start), PR_KHZ(affected_end));
+	wpa_printf(MSG_ERROR, "Neighboring BSS: freq=%g", PR_KHZ(pri));
 	return 0;
 }
 
diff --git a/src/ap/ieee802_11_shared.c b/src/ap/ieee802_11_shared.c
index 79ed450e27a8..6b6c13ee2f2d 100644
--- a/src/ap/ieee802_11_shared.c
+++ b/src/ap/ieee802_11_shared.c
@@ -76,9 +76,9 @@ void ieee802_11_send_sa_query_req(struct hostapd_data *hapd,
 #ifdef CONFIG_TESTING_OPTIONS
 		if (hapd->conf->oci_freq_override_saquery_req) {
 			wpa_printf(MSG_INFO,
-				   "TEST: Override OCI frequency %d -> %u MHz",
-				   ci.frequency,
-				   hapd->conf->oci_freq_override_saquery_req);
+				   "TEST: Override OCI frequency %g -> %g MHz",
+				   PR_KHZ(ci.frequency),
+				   PR_KHZ(hapd->conf->oci_freq_override_saquery_req));
 			ci.frequency =
 				hapd->conf->oci_freq_override_saquery_req;
 		}
@@ -165,9 +165,9 @@ static void ieee802_11_send_sa_query_resp(struct hostapd_data *hapd,
 #ifdef CONFIG_TESTING_OPTIONS
 		if (hapd->conf->oci_freq_override_saquery_resp) {
 			wpa_printf(MSG_INFO,
-				   "TEST: Override OCI frequency %d -> %u MHz",
-				   ci.frequency,
-				   hapd->conf->oci_freq_override_saquery_resp);
+				   "TEST: Override OCI frequency %g -> %g MHz",
+				   PR_KHZ(ci.frequency),
+				   PR_KHZ(hapd->conf->oci_freq_override_saquery_resp));
 			ci.frequency =
 				hapd->conf->oci_freq_override_saquery_resp;
 		}
diff --git a/src/ap/neighbor_db.c b/src/ap/neighbor_db.c
index 01bf88623724..050b19334aa2 100644
--- a/src/ap/neighbor_db.c
+++ b/src/ap/neighbor_db.c
@@ -278,7 +278,7 @@ void hostapd_neighbor_set_own_report(struct hostapd_data *hapd)
 					hapd->iconf);
 	} else if (ht) {
 		ieee80211_freq_to_chan(hapd->iface->freq +
-				       10 * hapd->iconf->secondary_channel,
+				       KHZ(10 * hapd->iconf->secondary_channel),
 				       &center_freq1_idx);
 	}
 
diff --git a/src/ap/wnm_ap.c b/src/ap/wnm_ap.c
index 248f5a1cff68..96d5c990241f 100644
--- a/src/ap/wnm_ap.c
+++ b/src/ap/wnm_ap.c
@@ -106,9 +106,9 @@ static int ieee802_11_send_wnmsleep_resp(struct hostapd_data *hapd,
 #ifdef CONFIG_TESTING_OPTIONS
 		if (hapd->conf->oci_freq_override_wnm_sleep) {
 			wpa_printf(MSG_INFO,
-				   "TEST: Override OCI frequency %d -> %u MHz",
-				   ci.frequency,
-				   hapd->conf->oci_freq_override_wnm_sleep);
+				   "TEST: Override OCI frequency %g -> %g MHz",
+				   PR_KHZ(ci.frequency),
+				   PR_KHZ(hapd->conf->oci_freq_override_wnm_sleep));
 			ci.frequency = hapd->conf->oci_freq_override_wnm_sleep;
 		}
 #endif /* CONFIG_TESTING_OPTIONS */
diff --git a/src/ap/wpa_auth.c b/src/ap/wpa_auth.c
index 9e6c0cad3c29..fb0c3b9a9e7e 100644
--- a/src/ap/wpa_auth.c
+++ b/src/ap/wpa_auth.c
@@ -2775,9 +2775,9 @@ static struct wpabuf * fils_prepare_plainbuf(struct wpa_state_machine *sm,
 #ifdef CONFIG_TESTING_OPTIONS
 		if (conf->oci_freq_override_fils_assoc) {
 			wpa_printf(MSG_INFO,
-				   "TEST: Override OCI frequency %d -> %u MHz",
-				   ci.frequency,
-				   conf->oci_freq_override_fils_assoc);
+				   "TEST: Override OCI frequency %g -> %g MHz",
+				   PR_KHZ(ci.frequency),
+				   PR_KHZ(conf->oci_freq_override_fils_assoc));
 			ci.frequency = conf->oci_freq_override_fils_assoc;
 		}
 #endif /* CONFIG_TESTING_OPTIONS */
@@ -3264,8 +3264,8 @@ static int ocv_oci_add(struct wpa_state_machine *sm, u8 **argpos,
 #ifdef CONFIG_TESTING_OPTIONS
 	if (freq) {
 		wpa_printf(MSG_INFO,
-			   "TEST: Override OCI KDE frequency %d -> %u MHz",
-			   ci.frequency, freq);
+			   "TEST: Override OCI KDE frequency %g -> %g MHz",
+			   PR_KHZ(ci.frequency), PR_KHZ(freq));
 		ci.frequency = freq;
 	}
 #endif /* CONFIG_TESTING_OPTIONS */
diff --git a/src/ap/wpa_auth_ft.c b/src/ap/wpa_auth_ft.c
index db272d41e4d4..8ce7f8e26a18 100644
--- a/src/ap/wpa_auth_ft.c
+++ b/src/ap/wpa_auth_ft.c
@@ -2664,9 +2664,9 @@ u8 * wpa_sm_write_assoc_resp_ies(struct wpa_state_machine *sm, u8 *pos,
 #ifdef CONFIG_TESTING_OPTIONS
 			if (conf->oci_freq_override_ft_assoc) {
 				wpa_printf(MSG_INFO,
-					   "TEST: Override OCI frequency %d -> %u MHz",
-					   ci.frequency,
-					   conf->oci_freq_override_ft_assoc);
+					   "TEST: Override OCI frequency %g -> %g MHz",
+					   PR_KHZ(ci.frequency),
+					   PR_KHZ(conf->oci_freq_override_ft_assoc));
 				ci.frequency = conf->oci_freq_override_ft_assoc;
 			}
 #endif /* CONFIG_TESTING_OPTIONS */
diff --git a/src/common/dpp.c b/src/common/dpp.c
index dc66ce913c9d..f6e30a364a8f 100644
--- a/src/common/dpp.c
+++ b/src/common/dpp.c
@@ -243,8 +243,8 @@ int dpp_parse_uri_chan_list(struct dpp_bootstrap_info *bi,
 			pos++;
 		freq = ieee80211_chan_to_freq(NULL, opclass, channel);
 		wpa_printf(MSG_DEBUG,
-			   "DPP: URI channel-list: opclass=%d channel=%d ==> freq=%d",
-			   opclass, channel, freq);
+			   "DPP: URI channel-list: opclass=%d channel=%d ==> freq=%g",
+			   opclass, channel, PR_KHZ(freq));
 		if (freq < 0) {
 			wpa_printf(MSG_DEBUG,
 				   "DPP: Ignore unknown URI channel-list channel (opclass=%d channel=%d)",
@@ -469,7 +469,8 @@ static int dpp_channel_ok_init(struct hostapd_hw_modes *own_modes,
 		}
 	}
 
-	wpa_printf(MSG_DEBUG, "DPP: Peer channel %u MHz not supported", freq);
+	wpa_printf(MSG_DEBUG, "DPP: Peer channel %g MHz not supported",
+		   PR_KHZ(freq));
 	return 0;
 }
 
@@ -536,9 +537,9 @@ static int dpp_channel_local_list(struct dpp_authentication *auth,
 	auth->num_freq = 0;
 
 	if (!own_modes || !num_modes) {
-		auth->freq[0] = 2412;
-		auth->freq[1] = 2437;
-		auth->freq[2] = 2462;
+		auth->freq[0] = KHZ(2412);
+		auth->freq[1] = KHZ(2437);
+		auth->freq[2] = KHZ(2462);
 		auth->num_freq = 3;
 		return 0;
 	}
@@ -591,9 +592,9 @@ int dpp_prepare_channel_list(struct dpp_authentication *auth,
 
 	/* Prioritize 2.4 GHz channels 6, 1, 11 (in this order) to hit the most
 	 * likely channels first. */
-	freq_to_start(auth->freq, auth->num_freq, 2462);
-	freq_to_start(auth->freq, auth->num_freq, 2412);
-	freq_to_start(auth->freq, auth->num_freq, 2437);
+	freq_to_start(auth->freq, auth->num_freq, KHZ(2462));
+	freq_to_start(auth->freq, auth->num_freq, KHZ(2412));
+	freq_to_start(auth->freq, auth->num_freq, KHZ(2437));
 
 	auth->freq_idx = 0;
 	auth->curr_freq = auth->freq[0];
@@ -601,7 +602,7 @@ int dpp_prepare_channel_list(struct dpp_authentication *auth,
 	pos = freqs;
 	end = pos + sizeof(freqs);
 	for (i = 0; i < auth->num_freq; i++) {
-		res = os_snprintf(pos, end - pos, " %u", auth->freq[i]);
+		res = os_snprintf(pos, end - pos, " %g", PR_KHZ(auth->freq[i]));
 		if (os_snprintf_error(end - pos, res))
 			break;
 		pos += res;
@@ -3908,7 +3909,7 @@ int dpp_bootstrap_info(struct dpp_global *dpp, int id,
 			   "mac_addr=" MACSTR "\n"
 			   "info=%s\n"
 			   "num_freq=%u\n"
-			   "use_freq=%u\n"
+			   "use_freq=%g\n"
 			   "curve=%s\n"
 			   "pkhash=%s\n"
 			   "version=%d\n",
@@ -3916,7 +3917,7 @@ int dpp_bootstrap_info(struct dpp_global *dpp, int id,
 			   MAC2STR(bi->mac_addr),
 			   bi->info ? bi->info : "",
 			   bi->num_freq,
-			   bi->num_freq == 1 ? bi->freq[0] : 0,
+			   bi->num_freq == 1 ? PR_KHZ(bi->freq[0]) : 0,
 			   bi->curve->name,
 			   pkhash,
 			   bi->version);
@@ -4025,13 +4026,13 @@ static int dpp_nfc_update_bi_channel(struct dpp_bootstrap_info *own_bi,
 	mode = ieee80211_freq_to_channel_ext(freq, 0, 0, &op_class, &channel);
 	if (mode == NUM_HOSTAPD_MODES) {
 		wpa_printf(MSG_DEBUG,
-			   "DPP: Could not determine operating class or channel number for %u MHz",
-			   freq);
+			   "DPP: Could not determine operating class or channel number for %g MHz",
+			   PR_KHZ(freq));
 	}
 
 	wpa_printf(MSG_DEBUG,
-		   "DPP: Selected %u MHz (op_class %u channel %u) as the negotiation channel based on information from NFC negotiated handover",
-		   freq, op_class, channel);
+		   "DPP: Selected %g MHz (op_class %u channel %u) as the negotiation channel based on information from NFC negotiated handover",
+		   PR_KHZ(freq), op_class, channel);
 	os_snprintf(chan, sizeof(chan), "%u/%u", op_class, channel);
 	os_free(own_bi->chan);
 	own_bi->chan = os_strdup(chan);
diff --git a/src/common/gas_server.c b/src/common/gas_server.c
index 5a1ea78997be..f0fcc1af0b81 100644
--- a/src/common/gas_server.c
+++ b/src/common/gas_server.c
@@ -60,9 +60,9 @@ static void gas_server_response_timeout(void *eloop_ctx, void *user_ctx)
 	struct gas_server_response *response = eloop_ctx;
 
 	wpa_printf(MSG_DEBUG, "GAS: Response @%p timeout for " MACSTR
-		   " (dialog_token=%u freq=%d frag_id=%u sent=%lu/%lu) - drop pending data",
+		   " (dialog_token=%u freq=%g frag_id=%u sent=%lu/%lu) - drop pending data",
 		   response, MAC2STR(response->dst), response->dialog_token,
-		   response->freq, response->frag_id,
+		   PR_KHZ(response->freq), response->frag_id,
 		   (unsigned long) response->offset,
 		   (unsigned long) (response->resp ?
 				    wpabuf_len(response->resp) : 0));
@@ -91,7 +91,7 @@ gas_server_send_resp(struct gas_server *gas, struct gas_server_handler *handler,
 		     const u8 *da, int freq, u8 dialog_token,
 		     struct wpabuf *query_resp, u16 comeback_delay)
 {
-	size_t max_len = (freq > 56160) ? 928 : 1400;
+	size_t max_len = (freq > KHZ(56160)) ? 928 : 1400;
 	size_t hdr_len = 24 + 2 + 5 + 3 + handler->adv_proto_id_len + 2;
 	size_t resp_frag_len;
 	struct wpabuf *resp;
@@ -255,7 +255,7 @@ gas_server_handle_rx_comeback_req(struct gas_server_response *response)
 {
 	struct gas_server_handler *handler = response->handler;
 	struct gas_server *gas = handler->gas;
-	size_t max_len = (response->freq > 56160) ? 928 : 1400;
+	size_t max_len = (response->freq > KHZ(56160)) ? 928 : 1400;
 	size_t hdr_len = 24 + 2 + 6 + 3 + handler->adv_proto_id_len + 2;
 	size_t remaining, resp_frag_len;
 	struct wpabuf *resp;
@@ -386,10 +386,10 @@ int gas_server_rx(struct gas_server *gas, const u8 *da, const u8 *sa,
 
 	wpa_printf(MSG_DEBUG, "GAS: Received GAS %s Request frame DA=" MACSTR
 		   " SA=" MACSTR " BSSID=" MACSTR
-		   " freq=%d dialog_token=%u len=%u",
+		   " freq=%g dialog_token=%u len=%u",
 		   action == WLAN_PA_GAS_INITIAL_REQ ? "Initial" : "Comeback",
-		   MAC2STR(da), MAC2STR(sa), MAC2STR(bssid), freq, dialog_token,
-		   (unsigned int) len);
+		   MAC2STR(da), MAC2STR(sa), MAC2STR(bssid), PR_KHZ(freq),
+		   dialog_token, (unsigned int) len);
 
 	if (action == WLAN_PA_GAS_INITIAL_REQ)
 		return gas_server_rx_initial_req(gas, da, sa, bssid,
diff --git a/src/common/hw_features_common.c b/src/common/hw_features_common.c
index f6c67a375037..fa788947ab53 100644
--- a/src/common/hw_features_common.c
+++ b/src/common/hw_features_common.c
@@ -121,8 +121,9 @@ int allowed_ht40_channel_pair(enum hostapd_hw_mode mode,
 	}
 
 	wpa_printf(MSG_DEBUG,
-		   "HT40: control channel: %d (%d MHz), secondary channel: %d (%d MHz)",
-		   pri_chan, p_chan->freq, sec_chan, s_chan->freq);
+		   "HT40: control channel: %d (%g MHz), secondary channel: %d (%g MHz)",
+		   pri_chan, PR_KHZ(p_chan->freq), sec_chan,
+		   PR_KHZ(s_chan->freq));
 
 	/* Verify that HT40 secondary channel is an allowed 20 MHz
 	 * channel */
@@ -262,7 +263,8 @@ static int check_20mhz_bss(struct wpa_scan_res *bss, int pri_freq, int start,
 	ieee802_11_parse_elems((u8 *) (bss + 1), bss->ie_len, &elems, 0);
 	if (!elems.ht_capabilities) {
 		wpa_printf(MSG_DEBUG, "Found overlapping legacy BSS: "
-			   MACSTR " freq=%d", MAC2STR(bss->bssid), bss->freq);
+			   MACSTR " freq=%g", MAC2STR(bss->bssid),
+			   PR_KHZ(bss->freq));
 		return 1;
 	}
 
@@ -272,7 +274,8 @@ static int check_20mhz_bss(struct wpa_scan_res *bss, int pri_freq, int start,
 			return 0;
 
 		wpa_printf(MSG_DEBUG, "Found overlapping 20 MHz HT BSS: "
-			   MACSTR " freq=%d", MAC2STR(bss->bssid), bss->freq);
+			   MACSTR " freq=%g", MAC2STR(bss->bssid),
+			   PR_KHZ(bss->freq));
 		return 1;
 	}
 	return 0;
@@ -296,8 +299,8 @@ int check_bss_coex_40mhz(struct wpa_scan_res *bss, int pri_freq, int sec_freq)
 	if (pri_freq == sec_freq)
 		return 1;
 
-	affected_start = (pri_freq + sec_freq) / 2 - 25;
-	affected_end = (pri_freq + sec_freq) / 2 + 25;
+	affected_start = (pri_freq + sec_freq) / 2 - KHZ(25);
+	affected_end = (pri_freq + sec_freq) / 2 + KHZ(25);
 
 	/* Check for overlapping 20 MHz BSS */
 	if (check_20mhz_bss(bss, pri_freq, affected_start, affected_end)) {
@@ -309,9 +312,9 @@ int check_bss_coex_40mhz(struct wpa_scan_res *bss, int pri_freq, int sec_freq)
 
 	if (sec_chan) {
 		if (sec_chan < pri_chan)
-			sec = pri - 20;
+			sec = pri - KHZ(20);
 		else
-			sec = pri + 20;
+			sec = pri + KHZ(20);
 	}
 
 	if ((pri < affected_start || pri > affected_end) &&
@@ -319,19 +322,19 @@ int check_bss_coex_40mhz(struct wpa_scan_res *bss, int pri_freq, int sec_freq)
 		return 0; /* not within affected channel range */
 
 	wpa_printf(MSG_DEBUG, "Neighboring BSS: " MACSTR
-		   " freq=%d pri=%d sec=%d",
-		   MAC2STR(bss->bssid), bss->freq, pri_chan, sec_chan);
+		   " freq=%g pri=%d sec=%d",
+		   MAC2STR(bss->bssid), PR_KHZ(bss->freq), pri_chan, sec_chan);
 
 	if (sec_chan) {
 		if (pri_freq != pri || sec_freq != sec) {
 			wpa_printf(MSG_DEBUG,
 				   "40 MHz pri/sec mismatch with BSS "
 				   MACSTR
-				   " <%d,%d> (chan=%d%c) vs. <%d,%d>",
+				   " <%g,%g> (chan=%d%c) vs. <%g,%g>",
 				   MAC2STR(bss->bssid),
-				   pri, sec, pri_chan,
+				   PR_KHZ(pri), PR_KHZ(sec), pri_chan,
 				   sec > pri ? '+' : '-',
-				   pri_freq, sec_freq);
+				   PR_KHZ(pri_freq), PR_KHZ(sec_freq));
 			return 1;
 		}
 	}
@@ -369,9 +372,9 @@ int check_40mhz_2g4(struct hostapd_hw_modes *mode,
 	pri_freq = hw_get_freq(mode, pri_chan);
 	sec_freq = hw_get_freq(mode, sec_chan);
 
-	wpa_printf(MSG_DEBUG, "40 MHz affected channel range: [%d,%d] MHz",
-		   (pri_freq + sec_freq) / 2 - 25,
-		   (pri_freq + sec_freq) / 2 + 25);
+	wpa_printf(MSG_DEBUG, "40 MHz affected channel range: [%g,%g] MHz",
+		   PR_KHZ((pri_freq + sec_freq) / 2 - KHZ(25)),
+		   PR_KHZ((pri_freq + sec_freq) / 2 + KHZ(25)));
 	for (i = 0; i < scan_res->num; i++) {
 		if (check_bss_coex_40mhz(scan_res->res[i], pri_freq, sec_freq))
 			return 0;
@@ -401,7 +404,7 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
 	data->vht_enabled = vht_enabled;
 	data->he_enabled = he_enabled;
 	data->sec_channel_offset = sec_channel_offset;
-	data->center_freq1 = freq + sec_channel_offset * 10;
+	data->center_freq1 = freq + KHZ(sec_channel_offset * 10);
 	data->center_freq2 = 0;
 	data->bandwidth = sec_channel_offset ? 40 : 20;
 
@@ -539,15 +542,21 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
 	case CHANWIDTH_USE_HT:
 		if (center_segment1 ||
 		    (center_segment0 != 0 &&
-		     5000 + center_segment0 * 5 != data->center_freq1 &&
-		     2407 + center_segment0 * 5 != data->center_freq1))
+		     KHZ(5000 + center_segment0 * 5) != data->center_freq1 &&
+		     KHZ(2407 + center_segment0 * 5) != data->center_freq1)) {
+			wpa_printf(MSG_ERROR,
+				   "something weird with center_segment0! %d", center_segment0);
 			return -1;
+		}
 		break;
 	case CHANWIDTH_80P80MHZ:
 		if (center_segment1 == center_segment0 + 4 ||
-		    center_segment1 == center_segment0 - 4)
+		    center_segment1 == center_segment0 - 4) {
+			wpa_printf(MSG_ERROR,
+				   "something weird with center_segment0 2! %d", center_segment0);
 			return -1;
-		data->center_freq2 = 5000 + center_segment1 * 5;
+		}
+		data->center_freq2 = KHZ(5000 + center_segment1 * 5);
 		/* fall through */
 	case CHANWIDTH_80MHZ:
 		data->bandwidth = 80;
@@ -555,8 +564,11 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
 		     center_segment1) ||
 		    (oper_chwidth == CHANWIDTH_80P80MHZ &&
 		     !center_segment1) ||
-		    !sec_channel_offset)
+		    !sec_channel_offset) {
+			wpa_printf(MSG_ERROR,
+				   "something weird with sec_channel_offset! %d", sec_channel_offset);
 			return -1;
+		}
 		if (!center_segment0) {
 			if (channel <= 48)
 				center_segment0 = 42;
@@ -570,7 +582,7 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
 				center_segment0 = 138;
 			else if (channel <= 161)
 				center_segment0 = 155;
-			data->center_freq1 = 5000 + center_segment0 * 5;
+			data->center_freq1 = KHZ(5000 + center_segment0 * 5);
 		} else {
 			/*
 			 * Note: HT/VHT config and params are coupled. Check if
@@ -581,9 +593,12 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
 			    center_segment0 == channel + 2 ||
 			    center_segment0 == channel - 2 ||
 			    center_segment0 == channel - 6)
-				data->center_freq1 = 5000 + center_segment0 * 5;
-			else
+				data->center_freq1 = KHZ(5000 + center_segment0 * 5);
+			else {
+				wpa_printf(MSG_ERROR,
+				   "something weird with center_segment0 3! %d", center_segment0);
 				return -1;
+			}
 		}
 		break;
 	case CHANWIDTH_160MHZ:
@@ -604,7 +619,7 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
 		    center_segment0 == channel - 6 ||
 		    center_segment0 == channel - 10 ||
 		    center_segment0 == channel - 14)
-			data->center_freq1 = 5000 + center_segment0 * 5;
+			data->center_freq1 = KHZ(5000 + center_segment0 * 5);
 		else
 			return -1;
 		break;
@@ -764,5 +779,7 @@ int chan_bw_allowed(const struct hostapd_channel_data *chan, u32 bw,
 int chan_pri_allowed(const struct hostapd_channel_data *chan)
 {
 	return !(chan->flag & HOSTAPD_CHAN_DISABLED) &&
-		(chan->allowed_bw & HOSTAPD_CHAN_WIDTH_20);
+		(chan->allowed_bw & (HOSTAPD_CHAN_WIDTH_20 |
+				     HOSTAPD_CHAN_WIDTH_1 |
+				     HOSTAPD_CHAN_WIDTH_2));
 }
diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c
index c4e744693d56..4f176aaa6628 100644
--- a/src/common/ieee802_11_common.c
+++ b/src/common/ieee802_11_common.c
@@ -858,31 +858,30 @@ int hostapd_config_tx_queue(struct hostapd_tx_queue_params tx_queue[],
 	return 0;
 }
 
-
-enum hostapd_hw_mode ieee80211_freq_to_chan(int freq, u8 *channel)
+enum hostapd_hw_mode ieee80211_freq_to_chan(int freq_khz, u8 *channel)
 {
 	u8 op_class;
 
-	return ieee80211_freq_to_channel_ext(freq, 0, CHANWIDTH_USE_HT,
+	return ieee80211_freq_to_channel_ext(freq_khz, 0, CHANWIDTH_USE_HT,
 					     &op_class, channel);
 }
 
-
 /**
  * ieee80211_freq_to_channel_ext - Convert frequency into channel info
  * for HT40 and VHT. DFS channels are not covered.
- * @freq: Frequency (MHz) to convert
+ * @freq: Frequency (KHz) to convert
  * @sec_channel: 0 = non-HT40, 1 = sec. channel above, -1 = sec. channel below
  * @chanwidth: VHT/EDMG channel width (CHANWIDTH_*)
  * @op_class: Buffer for returning operating class
  * @channel: Buffer for returning channel number
  * Returns: hw_mode on success, NUM_HOSTAPD_MODES on failure
  */
-enum hostapd_hw_mode ieee80211_freq_to_channel_ext(unsigned int freq,
+enum hostapd_hw_mode ieee80211_freq_to_channel_ext(unsigned int freq_khz,
 						   int sec_channel,
 						   int chanwidth,
 						   u8 *op_class, u8 *channel)
 {
+	int freq = MHZ(freq_khz);
 	u8 vht_opclass;
 
 	/* TODO: more operating classes */
@@ -1126,8 +1125,8 @@ int ieee80211_chaninfo_to_channel(unsigned int freq, enum chan_width chanwidth,
 	if (ieee80211_freq_to_channel_ext(freq, sec_channel, cw, op_class,
 					  channel) == NUM_HOSTAPD_MODES) {
 		wpa_printf(MSG_WARNING,
-			   "Cannot determine operating class and channel (freq=%u chanwidth=%d sec_channel=%d)",
-			   freq, chanwidth, sec_channel);
+			   "Cannot determine operating class and channel (freq=%g chanwidth=%d sec_channel=%d)",
+			   PR_KHZ(freq), chanwidth, sec_channel);
 		return -1;
 	}
 
@@ -1178,7 +1177,7 @@ static int ieee80211_chan_to_freq_us(u8 op_class, u8 chan)
 	case 33: /* channels 5..11; 40 MHz */
 		if (chan < 1 || chan > 11)
 			return -1;
-		return 2407 + 5 * chan;
+		return KHZ(2407 + 5 * chan);
 	case 1: /* channels 36,40,44,48 */
 	case 2: /* channels 52,56,60,64; dfs */
 	case 22: /* channels 36,44; 40 MHz */
@@ -1187,12 +1186,12 @@ static int ieee80211_chan_to_freq_us(u8 op_class, u8 chan)
 	case 28: /* channels 56,64; 40 MHz */
 		if (chan < 36 || chan > 64)
 			return -1;
-		return 5000 + 5 * chan;
+		return KHZ(5000 + 5 * chan);
 	case 4: /* channels 100-144 */
 	case 24: /* channels 100-140; 40 MHz */
 		if (chan < 100 || chan > 144)
 			return -1;
-		return 5000 + 5 * chan;
+		return KHZ(5000 + 5 * chan);
 	case 3: /* channels 149,153,157,161 */
 	case 25: /* channels 149,157; 40 MHz */
 	case 26: /* channels 149,157; 40 MHz */
@@ -1200,27 +1199,27 @@ static int ieee80211_chan_to_freq_us(u8 op_class, u8 chan)
 	case 31: /* channels 153,161; 40 MHz */
 		if (chan < 149 || chan > 161)
 			return -1;
-		return 5000 + 5 * chan;
+		return KHZ(5000 + 5 * chan);
 	case 5: /* channels 149,153,157,161,165 */
 		if (chan < 149 || chan > 165)
 			return -1;
-		return 5000 + 5 * chan;
+		return KHZ(5000 + 5 * chan);
 	case 34: /* 60 GHz band, channels 1..8 */
 		if (chan < 1 || chan > 8)
 			return -1;
-		return 56160 + 2160 * chan;
+		return KHZ(56160 + 2160 * chan);
 	case 37: /* 60 GHz band, EDMG CB2, channels 9..15 */
 		if (chan < 9 || chan > 15)
 			return -1;
-		return 56160 + 2160 * (chan - 8);
+		return KHZ(56160 + 2160 * (chan - 8));
 	case 38: /* 60 GHz band, EDMG CB3, channels 17..22 */
 		if (chan < 17 || chan > 22)
 			return -1;
-		return 56160 + 2160 * (chan - 16);
+		return KHZ(56160 + 2160 * (chan - 16));
 	case 39: /* 60 GHz band, EDMG CB4, channels 25..29 */
 		if (chan < 25 || chan > 29)
 			return -1;
-		return 56160 + 2160 * (chan - 24);
+		return KHZ(56160 + 2160 * (chan - 24));
 	}
 	return -1;
 }
@@ -1234,7 +1233,7 @@ static int ieee80211_chan_to_freq_eu(u8 op_class, u8 chan)
 	case 12: /* channels 5..13; 40 MHz */
 		if (chan < 1 || chan > 13)
 			return -1;
-		return 2407 + 5 * chan;
+		return KHZ(2407 + 5 * chan);
 	case 1: /* channels 36,40,44,48 */
 	case 2: /* channels 52,56,60,64; dfs */
 	case 5: /* channels 36,44; 40 MHz */
@@ -1243,34 +1242,34 @@ static int ieee80211_chan_to_freq_eu(u8 op_class, u8 chan)
 	case 9: /* channels 56,64; 40 MHz */
 		if (chan < 36 || chan > 64)
 			return -1;
-		return 5000 + 5 * chan;
+		return KHZ(5000 + 5 * chan);
 	case 3: /* channels 100-140 */
 	case 7: /* channels 100-132; 40 MHz */
 	case 10: /* channels 104-136; 40 MHz */
 	case 16: /* channels 100-140 */
 		if (chan < 100 || chan > 140)
 			return -1;
-		return 5000 + 5 * chan;
+		return KHZ(5000 + 5 * chan);
 	case 17: /* channels 149,153,157,161,165,169 */
 		if (chan < 149 || chan > 169)
 			return -1;
-		return 5000 + 5 * chan;
+		return KHZ(5000 + 5 * chan);
 	case 18: /* 60 GHz band, channels 1..6 */
 		if (chan < 1 || chan > 6)
 			return -1;
-		return 56160 + 2160 * chan;
+		return KHZ(56160 + 2160 * chan);
 	case 21: /* 60 GHz band, EDMG CB2, channels 9..11 */
 		if (chan < 9 || chan > 11)
 			return -1;
-		return 56160 + 2160 * (chan - 8);
+		return KHZ(56160 + 2160 * (chan - 8));
 	case 22: /* 60 GHz band, EDMG CB3, channels 17..18 */
 		if (chan < 17 || chan > 18)
 			return -1;
-		return 56160 + 2160 * (chan - 16);
+		return KHZ(56160 + 2160 * (chan - 16));
 	case 23: /* 60 GHz band, EDMG CB4, channels 25 */
 		if (chan != 25)
 			return -1;
-		return 56160 + 2160 * (chan - 24);
+		return KHZ(56160 + 2160 * (chan - 24));
 	}
 	return -1;
 }
@@ -1284,11 +1283,11 @@ static int ieee80211_chan_to_freq_jp(u8 op_class, u8 chan)
 	case 57: /* channels 5..13; 40 MHz */
 		if (chan < 1 || chan > 13)
 			return -1;
-		return 2407 + 5 * chan;
+		return KHZ(2407 + 5 * chan);
 	case 31: /* channel 14 */
 		if (chan != 14)
 			return -1;
-		return 2414 + 5 * chan;
+		return KHZ(2414 + 5 * chan);
 	case 1: /* channels 34,38,42,46(old) or 36,40,44,48 */
 	case 32: /* channels 52,56,60,64 */
 	case 33: /* channels 52,56,60,64 */
@@ -1300,7 +1299,7 @@ static int ieee80211_chan_to_freq_jp(u8 op_class, u8 chan)
 	case 43: /* channels 56,64; 40 MHz */
 		if (chan < 34 || chan > 64)
 			return -1;
-		return 5000 + 5 * chan;
+		return KHZ(5000 + 5 * chan);
 	case 34: /* channels 100-140 */
 	case 35: /* channels 100-140 */
 	case 39: /* channels 100-132; 40 MHz */
@@ -1310,23 +1309,23 @@ static int ieee80211_chan_to_freq_jp(u8 op_class, u8 chan)
 	case 58: /* channels 100-140 */
 		if (chan < 100 || chan > 140)
 			return -1;
-		return 5000 + 5 * chan;
+		return KHZ(5000 + 5 * chan);
 	case 59: /* 60 GHz band, channels 1..6 */
 		if (chan < 1 || chan > 6)
 			return -1;
-		return 56160 + 2160 * chan;
+		return KHZ(56160 + 2160 * chan);
 	case 62: /* 60 GHz band, EDMG CB2, channels 9..11 */
 		if (chan < 9 || chan > 11)
 			return -1;
-		return 56160 + 2160 * (chan - 8);
+		return KHZ(56160 + 2160 * (chan - 8));
 	case 63: /* 60 GHz band, EDMG CB3, channels 17..18 */
 		if (chan < 17 || chan > 18)
 			return -1;
-		return 56160 + 2160 * (chan - 16);
+		return KHZ(56160 + 2160 * (chan - 16));
 	case 64: /* 60 GHz band, EDMG CB4, channel 25 */
 		if (chan != 25)
 			return -1;
-		return 56160 + 2160 * (chan - 24);
+		return KHZ(56160 + 2160 * (chan - 24));
 	}
 	return -1;
 }
@@ -1340,19 +1339,19 @@ static int ieee80211_chan_to_freq_cn(u8 op_class, u8 chan)
 	case 9: /* channels 5..13; 40 MHz */
 		if (chan < 1 || chan > 13)
 			return -1;
-		return 2407 + 5 * chan;
+		return KHZ(2407 + 5 * chan);
 	case 1: /* channels 36,40,44,48 */
 	case 2: /* channels 52,56,60,64; dfs */
 	case 4: /* channels 36,44; 40 MHz */
 	case 5: /* channels 52,60; 40 MHz */
 		if (chan < 36 || chan > 64)
 			return -1;
-		return 5000 + 5 * chan;
+		return KHZ(5000 + 5 * chan);
 	case 3: /* channels 149,153,157,161,165 */
 	case 6: /* channels 149,157; 40 MHz */
 		if (chan < 149 || chan > 165)
 			return -1;
-		return 5000 + 5 * chan;
+		return KHZ(5000 + 5 * chan);
 	}
 	return -1;
 }
@@ -1366,17 +1365,17 @@ static int ieee80211_chan_to_freq_global(u8 op_class, u8 chan)
 		/* channels 1..13 */
 		if (chan < 1 || chan > 13)
 			return -1;
-		return 2407 + 5 * chan;
+		return KHZ(2407 + 5 * chan);
 	case 82:
 		/* channel 14 */
 		if (chan != 14)
 			return -1;
-		return 2414 + 5 * chan;
+		return KHZ(2414 + 5 * chan);
 	case 83: /* channels 1..9; 40 MHz */
 	case 84: /* channels 5..13; 40 MHz */
 		if (chan < 1 || chan > 13)
 			return -1;
-		return 2407 + 5 * chan;
+		return KHZ(2407 + 5 * chan);
 	case 115: /* channels 36,40,44,48; indoor only */
 	case 116: /* channels 36,44; 40 MHz; indoor only */
 	case 117: /* channels 40,48; 40 MHz; indoor only */
@@ -1385,32 +1384,32 @@ static int ieee80211_chan_to_freq_global(u8 op_class, u8 chan)
 	case 120: /* channels 56,64; 40 MHz; dfs */
 		if (chan < 36 || chan > 64)
 			return -1;
-		return 5000 + 5 * chan;
+		return KHZ(5000 + 5 * chan);
 	case 121: /* channels 100-140 */
 	case 122: /* channels 100-142; 40 MHz */
 	case 123: /* channels 104-136; 40 MHz */
 		if (chan < 100 || chan > 140)
 			return -1;
-		return 5000 + 5 * chan;
+		return KHZ(5000 + 5 * chan);
 	case 124: /* channels 149,153,157,161 */
 	case 126: /* channels 149,157; 40 MHz */
 	case 127: /* channels 153,161; 40 MHz */
 		if (chan < 149 || chan > 161)
 			return -1;
-		return 5000 + 5 * chan;
+		return KHZ(5000 + 5 * chan);
 	case 125: /* channels 149,153,157,161,165,169 */
 		if (chan < 149 || chan > 169)
 			return -1;
-		return 5000 + 5 * chan;
+		return KHZ(5000 + 5 * chan);
 	case 128: /* center freqs 42, 58, 106, 122, 138, 155; 80 MHz */
 	case 130: /* center freqs 42, 58, 106, 122, 138, 155; 80 MHz */
 		if (chan < 36 || chan > 161)
 			return -1;
-		return 5000 + 5 * chan;
+		return KHZ(5000 + 5 * chan);
 	case 129: /* center freqs 50, 114; 160 MHz */
 		if (chan < 36 || chan > 128)
 			return -1;
-		return 5000 + 5 * chan;
+		return KHZ(5000 + 5 * chan);
 	case 131: /* UHB channels, 20 MHz: 1, 5, 9.. */
 	case 132: /* UHB channels, 40 MHz: 3, 11, 19.. */
 	case 133: /* UHB channels, 80 MHz: 7, 23, 39.. */
@@ -1418,23 +1417,23 @@ static int ieee80211_chan_to_freq_global(u8 op_class, u8 chan)
 	case 135: /* UHB channels, 80+80 MHz: 7, 23, 39.. */
 		if (chan < 1 || chan > 233)
 			return -1;
-		return 5940 + chan * 5;
+		return KHZ(5940 + chan * 5);
 	case 180: /* 60 GHz band, channels 1..8 */
 		if (chan < 1 || chan > 8)
 			return -1;
-		return 56160 + 2160 * chan;
+		return KHZ(56160 + 2160 * chan);
 	case 181: /* 60 GHz band, EDMG CB2, channels 9..15 */
 		if (chan < 9 || chan > 15)
 			return -1;
-		return 56160 + 2160 * (chan - 8);
+		return KHZ(56160 + 2160 * (chan - 8));
 	case 182: /* 60 GHz band, EDMG CB3, channels 17..22 */
 		if (chan < 17 || chan > 22)
 			return -1;
-		return 56160 + 2160 * (chan - 16);
+		return KHZ(56160 + 2160 * (chan - 16));
 	case 183: /* 60 GHz band, EDMG CB4, channel 25..29 */
 		if (chan < 25 || chan > 29)
 			return -1;
-		return 56160 + 2160 * (chan - 24);
+		return KHZ(56160 + 2160 * (chan - 24));
 	}
 	return -1;
 }
@@ -1444,7 +1443,7 @@ static int ieee80211_chan_to_freq_global(u8 op_class, u8 chan)
  * @country: Country code, if known; otherwise, global operating class is used
  * @op_class: Operating class
  * @chan: Channel number
- * Returns: Frequency in MHz or -1 if the specified channel is unknown
+ * Returns: Frequency in KHz or -1 if the specified channel is unknown
  */
 int ieee80211_chan_to_freq(const char *country, u8 op_class, u8 chan)
 {
@@ -1484,8 +1483,8 @@ int ieee80211_is_dfs(int freq, const struct hostapd_hw_modes *modes,
 	int i, j;
 
 	if (!modes || !num_modes)
-		return (freq >= 5260 && freq <= 5320) ||
-			(freq >= 5500 && freq <= 5700);
+		return (MHZ(freq) >= 5260 && MHZ(freq) <= 5320) ||
+			(MHZ(freq) >= 5500 && MHZ(freq) <= 5700);
 
 	for (i = 0; i < num_modes; i++) {
 		for (j = 0; j < modes[i].num_channels; j++) {
@@ -2208,10 +2207,10 @@ int center_idx_to_bw_6ghz(u8 idx)
 
 int is_6ghz_freq(int freq)
 {
-	if (freq < 5940 || freq > 7105)
+	if (freq < KHZ(5940) || freq > KHZ(7105))
 		return 0;
 
-	if (center_idx_to_bw_6ghz((freq - 5940) / 5) < 0)
+	if (center_idx_to_bw_6ghz((MHZ(freq) - 5940) / 5) < 0)
 		return 0;
 
 	return 1;
@@ -2230,12 +2229,12 @@ int is_6ghz_psc_frequency(int freq)
 
 	if (!is_6ghz_freq(freq))
 		return 0;
-	if ((((freq - 5940) / 5) & 0x3) != 0x1)
+	if ((((MHZ(freq) - 5940) / 5) & 0x3) != 0x1)
 		return 0;
 
-	i = (freq - 5940 + 55) % 80;
+	i = (MHZ(freq) - 5940 + 55) % 80;
 	if (i == 0)
-		i = (freq - 5940 + 55) / 80;
+		i = (MHZ(freq) - 5940 + 55) / 80;
 
 	if (i >= 1 && i <= 15)
 		return 1;
diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h
index 4d3037eee7e1..8f419d39e88d 100644
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -12,6 +12,10 @@
 
 #include <utils/common.h>
 
+#define MHZ(f) ((f) / 1000)
+#define KHZ(f) ((f) * 1000)
+#define PR_KHZ(f) MHZ((float) f)
+
 /* IEEE 802.11 defines */
 
 #define WLAN_FC_PVER		0x0003
diff --git a/src/common/ocv.c b/src/common/ocv.c
index 6c35117a725b..8ead2b1b1522 100644
--- a/src/common/ocv.c
+++ b/src/common/ocv.c
@@ -127,8 +127,8 @@ int ocv_verify_tx_params(const u8 *oci_ie, size_t oci_ie_len,
 	/* Primary frequency used to send frames to STA must match the STA's */
 	if ((int) ci->frequency != oci.freq) {
 		os_snprintf(ocv_errorstr, sizeof(ocv_errorstr),
-			    "primary channel mismatch in received OCI (we use %d but receiver is using %d)",
-			    ci->frequency, oci.freq);
+			    "primary channel mismatch in received OCI (we use %g but receiver is using %d)",
+			    PR_KHZ(ci->frequency), oci.freq);
 		return -1;
 	}
 
@@ -147,7 +147,7 @@ int ocv_verify_tx_params(const u8 *oci_ie, size_t oci_ie_len,
 	 * Note that the field ci->sec_channel is only filled in when we use
 	 * 40 MHz.
 	 */
-	if (tx_chanwidth == 40 && ci->frequency < 2500 &&
+	if (tx_chanwidth == 40 && ci->frequency < KHZ(2500) &&
 	    ci->sec_channel != oci.sec_channel) {
 		os_snprintf(ocv_errorstr, sizeof(ocv_errorstr),
 			    "secondary channel mismatch in received OCI (we use %d but receiver is using %d)",
diff --git a/src/common/wpa_common.c b/src/common/wpa_common.c
index 82a5a174fefc..876ae39de84f 100644
--- a/src/common/wpa_common.c
+++ b/src/common/wpa_common.c
@@ -1531,7 +1531,7 @@ int wpa_parse_wpa_ie_wpa(const u8 *wpa_ie, size_t wpa_ie_len,
 
 int wpa_default_rsn_cipher(int freq)
 {
-	if (freq > 56160)
+	if (freq > KHZ(56160))
 		return WPA_CIPHER_GCMP; /* DMG */
 
 	return WPA_CIPHER_CCMP;
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 0ecda49dd1df..4627c8b95e9a 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -66,6 +66,8 @@ enum hostapd_chan_width_attr {
 	HOSTAPD_CHAN_WIDTH_40M  = BIT(3),
 	HOSTAPD_CHAN_WIDTH_80   = BIT(4),
 	HOSTAPD_CHAN_WIDTH_160  = BIT(5),
+	HOSTAPD_CHAN_WIDTH_1	= BIT(6),
+	HOSTAPD_CHAN_WIDTH_2	= BIT(7),
 };
 
 /* Filter gratuitous ARP */
@@ -125,7 +127,7 @@ struct hostapd_channel_data {
 	short chan;
 
 	/**
-	 * freq - Frequency in MHz
+	 * freq - Frequency in KHz
 	 */
 	int freq;
 
@@ -323,7 +325,7 @@ struct hostapd_hw_modes {
  * struct wpa_scan_res - Scan result for an BSS/IBSS
  * @flags: information flags about the BSS/IBSS (WPA_SCAN_*)
  * @bssid: BSSID
- * @freq: frequency of the channel in MHz (e.g., 2412 = channel 1)
+ * @freq: frequency of the channel in KHz (e.g., 2412000 = channel 1)
  * @beacon_int: beacon interval in TUs (host byte order)
  * @caps: capability information field in host byte order
  * @qual: signal quality
@@ -447,7 +449,7 @@ struct wpa_driver_scan_params {
 	/**
 	 * freqs - Array of frequencies to scan or %NULL for all frequencies
 	 *
-	 * The frequency is set in MHz. The array is zero-terminated.
+	 * The frequency is set in kHz. The array is zero-terminated.
 	 */
 	int *freqs;
 
@@ -719,7 +721,7 @@ struct hostapd_freq_params {
 	enum hostapd_hw_mode mode;
 
 	/**
-	 * freq - Primary channel center frequency in MHz
+	 * freq - Primary channel center frequency in KHz
 	 */
 	int freq;
 
@@ -753,14 +755,14 @@ struct hostapd_freq_params {
 	int he_enabled;
 
 	/**
-	 * center_freq1 - Segment 0 center frequency in MHz
+	 * center_freq1 - Segment 0 center frequency in KHz
 	 *
 	 * Valid for both HT and VHT.
 	 */
 	int center_freq1;
 
 	/**
-	 * center_freq2 - Segment 1 center frequency in MHz
+	 * center_freq2 - Segment 1 center frequency in KHz
 	 *
 	 * Non-zero only for bandwidth 80 and an 80+80 channel
 	 */
@@ -2214,7 +2216,7 @@ enum smps_mode {
  * @center_frq2: center frequency for the second segment (if relevant)
  */
 struct wpa_signal_info {
-	u32 frequency;
+	int frequency;
 	int above_threshold;
 	int current_signal;
 	int avg_signal;
@@ -2238,7 +2240,7 @@ struct wpa_signal_info {
  *	derived from center_frq2 for convenience.
  */
 struct wpa_channel_info {
-	u32 frequency;
+	int frequency;
 	enum chan_width chanwidth;
 	int sec_channel;
 	int center_frq1;
@@ -2357,7 +2359,7 @@ struct drv_acs_params {
 	/* Configured ACS channel width */
 	u16 ch_width;
 
-	/* ACS frequency list info */
+	/* ACS frequency list (in KHz) */
 	const int *freq_list;
 
 	/* Indicates whether EDMG is enabled */
@@ -3360,7 +3362,7 @@ struct wpa_driver_ops {
 	/**
 	 * send_action - Transmit an Action frame
 	 * @priv: Private driver interface data
-	 * @freq: Frequency (in MHz) of the channel
+	 * @freq: Frequency (in KHz) of the channel
 	 * @wait: Time to wait off-channel for a response (in ms), or zero
 	 * @dst: Destination MAC address (Address 1)
 	 * @src: Source MAC address (Address 2)
@@ -3403,7 +3405,7 @@ struct wpa_driver_ops {
 	/**
 	 * remain_on_channel - Remain awake on a channel
 	 * @priv: Private driver interface data
-	 * @freq: Frequency (in MHz) of the channel
+	 * @freq: Frequency (in KHz) of the channel
 	 * @duration: Duration in milliseconds
 	 * Returns: 0 on success, -1 on failure
 	 *
@@ -5137,7 +5139,7 @@ union wpa_event_data {
 		size_t beacon_ies_len;
 
 		/**
-		 * freq - Frequency of the operational channel in MHz
+		 * freq - Frequency of the operational channel in KHz
 		 */
 		unsigned int freq;
 
@@ -5495,7 +5497,7 @@ union wpa_event_data {
 		void *drv_priv;
 
 		/**
-		 * freq - Frequency (in MHz) on which the frame was received
+		 * freq - Frequency (in KHz) on which the frame was received
 		 */
 		int freq;
 
@@ -5719,7 +5721,7 @@ union wpa_event_data {
 
 	/**
 	 * struct dfs_event - Data for radar detected events
-	 * @freq: Frequency of the channel in MHz
+	 * @freq: Frequency of the channel in KHz
 	 */
 	struct dfs_event {
 		int freq;
diff --git a/src/drivers/driver_atheros.c b/src/drivers/driver_atheros.c
index 9b4166d22947..f3ccaf37f06e 100644
--- a/src/drivers/driver_atheros.c
+++ b/src/drivers/driver_atheros.c
@@ -1434,7 +1434,8 @@ static void fetch_pending_big_events(struct atheros_driver_data *drv)
 			stype = WLAN_FC_GET_STYPE(fc);
 
 			wpa_printf(MSG_DEBUG, "athr: EV_RX_MGMT stype=%u "
-				"freq=%u len=%u", stype, freq, (int) data_len);
+				"freq=%u len=%u", stype, freq, (int)
+				data_len);
 
 			if (stype == WLAN_FC_STYPE_ACTION) {
 				os_memset(&event, 0, sizeof(event));
@@ -2072,6 +2073,7 @@ static int atheros_send_action(void *priv, unsigned int freq,
 	act = os_zalloc(sizeof(*act) + data_len);
 	if (act == NULL)
 		return -1;
+	freq = MHZ(freq);
 	act->freq = freq;
 	os_memcpy(act->dst_addr, dst, ETH_ALEN);
 	os_memcpy(act->src_addr, src, ETH_ALEN);
diff --git a/src/drivers/driver_bsd.c b/src/drivers/driver_bsd.c
index 5adee13a266d..9d9f73a7b5f9 100644
--- a/src/drivers/driver_bsd.c
+++ b/src/drivers/driver_bsd.c
@@ -1105,6 +1105,7 @@ wpa_driver_bsd_associate(void *priv, struct wpa_driver_associate_params *params)
 		, params->key_mgmt_suite
 	);
 
+	params->freq = MHZ(params->freq);
 	switch (params->mode) {
 	case IEEE80211_MODE_INFRA:
 		mode = 0 /* STA */;
@@ -1257,7 +1258,7 @@ wpa_driver_bsd_add_scan_entry(struct wpa_scan_results *res,
 	if (result == NULL)
 		return;
 	os_memcpy(result->bssid, sr->isr_bssid, ETH_ALEN);
-	result->freq = sr->isr_freq;
+	result->freq = KHZ(sr->isr_freq);
 	result->beacon_int = sr->isr_intval;
 	result->caps = sr->isr_capinfo;
 	result->qual = sr->isr_rssi;
diff --git a/src/drivers/driver_hostap.c b/src/drivers/driver_hostap.c
index b9c42e4db48d..92c291894866 100644
--- a/src/drivers/driver_hostap.c
+++ b/src/drivers/driver_hostap.c
@@ -1134,7 +1134,7 @@ static struct hostapd_hw_modes * hostap_get_hw_feature_data(void *priv,
 
 	for (i = 0; i < 14; i++) {
 		mode->channels[i].chan = i + 1;
-		mode->channels[i].freq = chan2freq[i];
+		mode->channels[i].freq = KHZ(chan2freq[i]);
 		mode->channels[i].allowed_bw = HOSTAPD_CHAN_WIDTH_20;
 		/* TODO: Get allowed channel list from the driver */
 		if (i >= 11)
diff --git a/src/drivers/driver_ndis.c b/src/drivers/driver_ndis.c
index b5fff483e78b..a17791567f6a 100644
--- a/src/drivers/driver_ndis.c
+++ b/src/drivers/driver_ndis.c
@@ -876,7 +876,7 @@ static struct wpa_scan_results * wpa_driver_ndis_get_scan_results(void *priv)
 
 		os_memcpy(r->bssid, bss->MacAddress, ETH_ALEN);
 		r->level = (int) bss->Rssi;
-		r->freq = bss->Configuration.DSConfig / 1000;
+		r->freq = KHZ(bss->Configuration.DSConfig / 1000);
 		fixed = (NDIS_802_11_FIXED_IEs *) bss->IEs;
 		r->beacon_int = WPA_GET_LE16((u8 *) &fixed->BeaconInterval);
 		r->caps = WPA_GET_LE16((u8 *) &fixed->Capabilities);
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 72189da240dd..7329e60403d5 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1355,15 +1355,15 @@ static int nl80211_get_assoc_freq_handler(struct nl_msg *msg, void *arg)
 	status = nla_get_u32(bss[NL80211_BSS_STATUS]);
 	if (status == NL80211_BSS_STATUS_ASSOCIATED &&
 	    bss[NL80211_BSS_FREQUENCY]) {
-		ctx->assoc_freq = nla_get_u32(bss[NL80211_BSS_FREQUENCY]);
-		wpa_printf(MSG_DEBUG, "nl80211: Associated on %u MHz",
-			   ctx->assoc_freq);
+		ctx->assoc_freq = KHZ(nla_get_u32(bss[NL80211_BSS_FREQUENCY]));
+		wpa_printf(MSG_DEBUG, "nl80211: Associated on %g MHz",
+			   PR_KHZ(ctx->assoc_freq));
 	}
 	if (status == NL80211_BSS_STATUS_IBSS_JOINED &&
 	    bss[NL80211_BSS_FREQUENCY]) {
-		ctx->ibss_freq = nla_get_u32(bss[NL80211_BSS_FREQUENCY]);
-		wpa_printf(MSG_DEBUG, "nl80211: IBSS-joined on %u MHz",
-			   ctx->ibss_freq);
+		ctx->ibss_freq = KHZ(nla_get_u32(bss[NL80211_BSS_FREQUENCY]));
+		wpa_printf(MSG_DEBUG, "nl80211: IBSS-joined on %g MHz",
+			   PR_KHZ(ctx->ibss_freq));
 	}
 	if (status == NL80211_BSS_STATUS_ASSOCIATED &&
 	    bss[NL80211_BSS_BSSID]) {
@@ -1453,7 +1453,8 @@ try_again:
 		unsigned int freq = drv->nlmode == NL80211_IFTYPE_ADHOC ?
 			arg.ibss_freq : arg.assoc_freq;
 		wpa_printf(MSG_DEBUG, "nl80211: Operating frequency for the "
-			   "associated BSS from scan results: %u MHz", freq);
+			   "associated BSS from scan results: %g MHz",
+			   PR_KHZ(freq));
 		if (freq)
 			drv->assoc_freq = freq;
 		return drv->assoc_freq;
@@ -1574,7 +1575,7 @@ static int get_link_noise(struct nl_msg *msg, void *arg)
 	if (!sinfo[NL80211_SURVEY_INFO_FREQUENCY])
 		return NL_SKIP;
 
-	if (nla_get_u32(sinfo[NL80211_SURVEY_INFO_FREQUENCY]) !=
+	if (KHZ((nla_get_u32(sinfo[NL80211_SURVEY_INFO_FREQUENCY]))) !=
 	    sig_change->frequency)
 		return NL_SKIP;
 
@@ -1615,7 +1616,7 @@ static int get_channel_info(struct nl_msg *msg, void *arg)
 
 	if (tb[NL80211_ATTR_WIPHY_FREQ])
 		chan_info->frequency =
-			nla_get_u32(tb[NL80211_ATTR_WIPHY_FREQ]);
+			KHZ(nla_get_u32(tb[NL80211_ATTR_WIPHY_FREQ]));
 	if (tb[NL80211_ATTR_CHANNEL_WIDTH])
 		chan_info->chanwidth = convert2width(
 			nla_get_u32(tb[NL80211_ATTR_CHANNEL_WIDTH]));
@@ -1637,10 +1638,10 @@ static int get_channel_info(struct nl_msg *msg, void *arg)
 	}
 	if (tb[NL80211_ATTR_CENTER_FREQ1])
 		chan_info->center_frq1 =
-			nla_get_u32(tb[NL80211_ATTR_CENTER_FREQ1]);
+			KHZ(nla_get_u32(tb[NL80211_ATTR_CENTER_FREQ1]));
 	if (tb[NL80211_ATTR_CENTER_FREQ2])
 		chan_info->center_frq2 =
-			nla_get_u32(tb[NL80211_ATTR_CENTER_FREQ2]);
+			KHZ(nla_get_u32(tb[NL80211_ATTR_CENTER_FREQ2]));
 
 	if (chan_info->center_frq2) {
 		u8 seg1_idx = 0;
@@ -3663,8 +3664,8 @@ retry:
 			goto fail;
 	}
 	if (params->freq) {
-		wpa_printf(MSG_DEBUG, "  * freq=%d", params->freq);
-		if (nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, params->freq))
+		wpa_printf(MSG_DEBUG, "  * freq=%g", PR_KHZ(params->freq));
+		if (nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, MHZ(params->freq)))
 			goto fail;
 	}
 	if (params->ssid) {
@@ -3828,9 +3829,9 @@ static int wpa_driver_nl80211_send_mlme(struct i802_bss *bss, const u8 *data,
 	mgmt = (struct ieee80211_mgmt *) data;
 	fc = le_to_host16(mgmt->frame_control);
 	wpa_printf(MSG_DEBUG, "nl80211: send_mlme - da=" MACSTR
-		   " noack=%d freq=%u no_cck=%d offchanok=%d wait_time=%u no_encrypt=%d fc=0x%x (%s) nlmode=%d",
-		   MAC2STR(mgmt->da), noack, freq, no_cck, offchanok, wait_time,
-		   no_encrypt, fc, fc2str(fc), drv->nlmode);
+		   " noack=%d freq=%g no_cck=%d offchanok=%d wait_time=%u no_encrypt=%d fc=0x%x (%s) nlmode=%d",
+		   MAC2STR(mgmt->da), noack, PR_KHZ(freq), no_cck, offchanok,
+		   wait_time, no_encrypt, fc, fc2str(fc), drv->nlmode);
 
 	if ((is_sta_interface(drv->nlmode) ||
 	     drv->nlmode == NL80211_IFTYPE_P2P_DEVICE) &&
@@ -3842,8 +3843,8 @@ static int wpa_driver_nl80211_send_mlme(struct i802_bss *bss, const u8 *data,
 		 * of wpa_supplicant.
 		 */
 		if (freq == 0) {
-			wpa_printf(MSG_DEBUG, "nl80211: Use last_mgmt_freq=%d",
-				   drv->last_mgmt_freq);
+			wpa_printf(MSG_DEBUG, "nl80211: Use last_mgmt_freq=%g",
+				   PR_KHZ(drv->last_mgmt_freq));
 			freq = drv->last_mgmt_freq;
 		}
 		wait_time = 0;
@@ -3855,8 +3856,8 @@ static int wpa_driver_nl80211_send_mlme(struct i802_bss *bss, const u8 *data,
 
 	if (drv->device_ap_sme && is_ap_interface(drv->nlmode)) {
 		if (freq == 0) {
-			wpa_printf(MSG_DEBUG, "nl80211: Use bss->freq=%d",
-				   bss->freq);
+			wpa_printf(MSG_DEBUG, "nl80211: Use bss->freq=%g",
+				   PR_KHZ(bss->freq));
 			freq = bss->freq;
 		}
 		if ((int) freq == bss->freq)
@@ -3885,26 +3886,26 @@ static int wpa_driver_nl80211_send_mlme(struct i802_bss *bss, const u8 *data,
 	    WLAN_FC_GET_STYPE(fc) == WLAN_FC_STYPE_AUTH) {
 		freq = nl80211_get_assoc_freq(drv);
 		wpa_printf(MSG_DEBUG,
-			   "nl80211: send_mlme - Use assoc_freq=%u for external auth",
-			   freq);
+			   "nl80211: send_mlme - Use assoc_freq=%g for external auth",
+			   PR_KHZ(freq));
 	}
 
 	if (freq == 0 && drv->nlmode == NL80211_IFTYPE_ADHOC) {
 		freq = nl80211_get_assoc_freq(drv);
 		wpa_printf(MSG_DEBUG,
-			   "nl80211: send_mlme - Use assoc_freq=%u for IBSS",
-			   freq);
+			   "nl80211: send_mlme - Use assoc_freq=%g for IBSS",
+			   PR_KHZ(freq));
 	}
 	if (freq == 0) {
-		wpa_printf(MSG_DEBUG, "nl80211: send_mlme - Use bss->freq=%u",
-			   bss->freq);
+		wpa_printf(MSG_DEBUG, "nl80211: send_mlme - Use bss->freq=%g",
+			   PR_KHZ(bss->freq));
 		freq = bss->freq;
 	}
 
 	if (drv->use_monitor) {
 		wpa_printf(MSG_DEBUG,
-			   "nl80211: send_frame(freq=%u bss->freq=%u) -> send_monitor",
-			   freq, bss->freq);
+			   "nl80211: send_frame(freq=%g bss->freq=%g) -> send_monitor",
+			   PR_KHZ(freq), PR_KHZ(bss->freq));
 		return nl80211_send_monitor(drv, data, data_len, encrypt,
 					    noack);
 	}
@@ -4539,15 +4540,15 @@ fail:
 }
 
 
-static int nl80211_put_freq_params(struct nl_msg *msg,
+static int nl80211_put_freq_params(struct nl_msg *msg, const u64 flags,
 				   const struct hostapd_freq_params *freq)
 {
 	enum hostapd_hw_mode hw_mode;
 	int is_24ghz;
 	u8 channel;
 
-	wpa_printf(MSG_DEBUG, "  * freq=%d", freq->freq);
-	if (nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, freq->freq))
+	wpa_printf(MSG_DEBUG, "  * freq=%g", PR_KHZ(freq->freq));
+	if (nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, MHZ(freq->freq)))
 		return -ENOBUFS;
 
 	wpa_printf(MSG_DEBUG, "  * he_enabled=%d", freq->he_enabled);
@@ -4583,16 +4584,16 @@ static int nl80211_put_freq_params(struct nl_msg *msg,
 		}
 
 		wpa_printf(MSG_DEBUG, "  * channel_width=%d", cw);
-		wpa_printf(MSG_DEBUG, "  * center_freq1=%d",
-			   freq->center_freq1);
-		wpa_printf(MSG_DEBUG, "  * center_freq2=%d",
-			   freq->center_freq2);
+		wpa_printf(MSG_DEBUG, "  * center_freq1=%g",
+			   PR_KHZ(freq->center_freq1));
+		wpa_printf(MSG_DEBUG, "  * center_freq2=%g",
+			   PR_KHZ(freq->center_freq2));
 		if (nla_put_u32(msg, NL80211_ATTR_CHANNEL_WIDTH, cw) ||
 		    nla_put_u32(msg, NL80211_ATTR_CENTER_FREQ1,
-				freq->center_freq1) ||
+				MHZ(freq->center_freq1)) ||
 		    (freq->center_freq2 &&
 		     nla_put_u32(msg, NL80211_ATTR_CENTER_FREQ2,
-				 freq->center_freq2)))
+				 MHZ(freq->center_freq2))))
 			return -ENOBUFS;
 	} else if (freq->ht_enabled) {
 		enum nl80211_channel_type ct;
@@ -4642,13 +4643,14 @@ static int nl80211_set_channel(struct i802_bss *bss,
 	int ret;
 
 	wpa_printf(MSG_DEBUG,
-		   "nl80211: Set freq %d (ht_enabled=%d, vht_enabled=%d, he_enabled=%d, bandwidth=%d MHz, cf1=%d MHz, cf2=%d MHz)",
-		   freq->freq, freq->ht_enabled, freq->vht_enabled, freq->he_enabled,
-		   freq->bandwidth, freq->center_freq1, freq->center_freq2);
+		   "nl80211: Set freq %g (ht_enabled=%d, vht_enabled=%d, he_enabled=%d, bandwidth=%d MHz, cf1=%g MHz, cf2=%g MHz)",
+		   PR_KHZ(freq->freq), freq->ht_enabled, freq->vht_enabled,
+		   freq->he_enabled, freq->bandwidth, PR_KHZ(freq->center_freq1),
+		   PR_KHZ(freq->center_freq2));
 
 	msg = nl80211_drv_msg(drv, 0, set_chan ? NL80211_CMD_SET_CHANNEL :
 			      NL80211_CMD_SET_WIPHY);
-	if (!msg || nl80211_put_freq_params(msg, freq) < 0) {
+	if (!msg || nl80211_put_freq_params(msg, drv->capa.flags, freq) < 0) {
 		nlmsg_free(msg);
 		return -1;
 	}
@@ -4658,8 +4660,8 @@ static int nl80211_set_channel(struct i802_bss *bss,
 		bss->freq = freq->freq;
 		return 0;
 	}
-	wpa_printf(MSG_DEBUG, "nl80211: Failed to set channel (freq=%d): "
-		   "%d (%s)", freq->freq, ret, strerror(-ret));
+	wpa_printf(MSG_DEBUG, "nl80211: Failed to set channel (freq=%g): "
+		   "%d (%s)", PR_KHZ(freq->freq), ret, strerror(-ret));
 	return -1;
 }
 
@@ -5602,7 +5604,7 @@ retry:
 	os_memcpy(drv->ssid, params->ssid, params->ssid_len);
 	drv->ssid_len = params->ssid_len;
 
-	if (nl80211_put_freq_params(msg, &params->freq) < 0 ||
+	if (nl80211_put_freq_params(msg, drv->capa.flags, &params->freq) < 0 ||
 	    nl80211_put_beacon_int(msg, params->beacon_int))
 		goto fail;
 
@@ -5735,9 +5737,10 @@ static int nl80211_connect_common(struct wpa_driver_nl80211_data *drv,
 	}
 
 	if (params->freq.freq) {
-		wpa_printf(MSG_DEBUG, "  * freq=%d", params->freq.freq);
+		wpa_printf(MSG_DEBUG, "  * freq=%g",
+			   PR_KHZ(params->freq.freq));
 		if (nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ,
-				params->freq.freq))
+				MHZ(params->freq.freq)))
 			return -1;
 		drv->assoc_freq = params->freq.freq;
 	} else
@@ -5746,7 +5749,7 @@ static int nl80211_connect_common(struct wpa_driver_nl80211_data *drv,
 	if (params->freq_hint) {
 		wpa_printf(MSG_DEBUG, "  * freq_hint=%d", params->freq_hint);
 		if (nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ_HINT,
-				params->freq_hint))
+				MHZ(params->freq_hint)))
 			return -1;
 	}
 
@@ -7722,13 +7725,14 @@ static int nl80211_send_frame_cmd(struct i802_bss *bss,
 	u64 cookie;
 	int ret = -1;
 
-	wpa_printf(MSG_MSGDUMP, "nl80211: CMD_FRAME freq=%u wait=%u no_cck=%d "
+	wpa_printf(MSG_MSGDUMP, "nl80211: CMD_FRAME freq=%g wait=%u no_cck=%d "
 		   "no_ack=%d offchanok=%d",
-		   freq, wait, no_cck, no_ack, offchanok);
+		   PR_KHZ(freq), wait, no_cck, no_ack, offchanok);
 	wpa_hexdump(MSG_MSGDUMP, "CMD_FRAME", buf, buf_len);
 
 	if (!(msg = nl80211_cmd_msg(bss, 0, NL80211_CMD_FRAME)) ||
-	    (freq && nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, freq)) ||
+	    (freq && nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ,
+				 MHZ(freq))) ||
 	    (wait && nla_put_u32(msg, NL80211_ATTR_DURATION, wait)) ||
 	    (offchanok && ((drv->capa.flags & WPA_DRIVER_FLAGS_OFFCHANNEL_TX) ||
 			   drv->test_use_roc_tx) &&
@@ -7745,8 +7749,8 @@ static int nl80211_send_frame_cmd(struct i802_bss *bss,
 	msg = NULL;
 	if (ret) {
 		wpa_printf(MSG_DEBUG, "nl80211: Frame command failed: ret=%d "
-			   "(%s) (freq=%u wait=%u)", ret, strerror(-ret),
-			   freq, wait);
+			   "(%s) (freq=%g wait=%u)", ret, strerror(-ret),
+			   PR_KHZ(freq), wait);
 	} else {
 		wpa_printf(MSG_MSGDUMP, "nl80211: Frame TX command accepted%s; "
 			   "cookie 0x%llx", no_ack ? " (no ACK)" : "",
@@ -7795,8 +7799,8 @@ static int wpa_driver_nl80211_send_action(struct i802_bss *bss,
 		offchanok = 0;
 
 	wpa_printf(MSG_DEBUG, "nl80211: Send Action frame (ifindex=%d, "
-		   "freq=%u MHz wait=%d ms no_cck=%d offchanok=%d)",
-		   drv->ifindex, freq, wait_time, no_cck, offchanok);
+		   "freq=%g MHz wait=%d ms no_cck=%d offchanok=%d)",
+		   drv->ifindex, PR_KHZ(freq), wait_time, no_cck, offchanok);
 
 	buf = os_zalloc(24 + data_len);
 	if (buf == NULL)
@@ -7889,7 +7893,7 @@ static int wpa_driver_nl80211_remain_on_channel(void *priv, unsigned int freq,
 	u64 cookie;
 
 	if (!(msg = nl80211_cmd_msg(bss, 0, NL80211_CMD_REMAIN_ON_CHANNEL)) ||
-	    nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, freq) ||
+	    nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, MHZ(freq)) ||
 	    nla_put_u32(msg, NL80211_ATTR_DURATION, duration)) {
 		nlmsg_free(msg);
 		return -1;
@@ -7899,15 +7903,16 @@ static int wpa_driver_nl80211_remain_on_channel(void *priv, unsigned int freq,
 	ret = send_and_recv_msgs(drv, msg, cookie_handler, &cookie);
 	if (ret == 0) {
 		wpa_printf(MSG_DEBUG, "nl80211: Remain-on-channel cookie "
-			   "0x%llx for freq=%u MHz duration=%u",
-			   (long long unsigned int) cookie, freq, duration);
+			   "0x%llx for freq=%g MHz duration=%u",
+			   (long long unsigned int) cookie, PR_KHZ(freq),
+			   duration);
 		drv->remain_on_chan_cookie = cookie;
 		drv->pending_remain_on_chan = 1;
 		return 0;
 	}
 	wpa_printf(MSG_DEBUG, "nl80211: Failed to request remain-on-channel "
-		   "(freq=%d duration=%u): %d (%s)",
-		   freq, duration, ret, strerror(-ret));
+		   "(freq=%g duration=%u): %d (%s)",
+		   PR_KHZ(freq), duration, ret, strerror(-ret));
 	return -1;
 }
 
@@ -8152,10 +8157,10 @@ static int get_channel_width(struct nl_msg *msg, void *arg)
 			nla_get_u32(tb[NL80211_ATTR_CHANNEL_WIDTH]));
 		if (tb[NL80211_ATTR_CENTER_FREQ1])
 			sig_change->center_frq1 =
-				nla_get_u32(tb[NL80211_ATTR_CENTER_FREQ1]);
+				KHZ(nla_get_u32(tb[NL80211_ATTR_CENTER_FREQ1]));
 		if (tb[NL80211_ATTR_CENTER_FREQ2])
 			sig_change->center_frq2 =
-				nla_get_u32(tb[NL80211_ATTR_CENTER_FREQ2]);
+				KHZ(nla_get_u32(tb[NL80211_ATTR_CENTER_FREQ2]));
 	}
 
 	return NL_SKIP;
@@ -8460,7 +8465,7 @@ static void add_survey(struct nlattr **sinfo, u32 ifidx,
 		return;
 
 	survey->ifidx = ifidx;
-	survey->freq = nla_get_u32(sinfo[NL80211_SURVEY_INFO_FREQUENCY]);
+	survey->freq = KHZ(nla_get_u32(sinfo[NL80211_SURVEY_INFO_FREQUENCY]));
 	survey->filled = 0;
 
 	if (sinfo[NL80211_SURVEY_INFO_NOISE]) {
@@ -8493,8 +8498,8 @@ static void add_survey(struct nlattr **sinfo, u32 ifidx,
 		survey->filled |= SURVEY_HAS_CHAN_TIME_TX;
 	}
 
-	wpa_printf(MSG_DEBUG, "nl80211: Freq survey dump event (freq=%d MHz noise=%d channel_time=%ld busy_time=%ld tx_time=%ld rx_time=%ld filled=%04x)",
-		   survey->freq,
+	wpa_printf(MSG_DEBUG, "nl80211: Freq survey dump event (freq=%g MHz noise=%d channel_time=%ld busy_time=%ld tx_time=%ld rx_time=%ld filled=%04x)",
+		   PR_KHZ(survey->freq),
 		   survey->nf,
 		   (unsigned long int) survey->channel_time,
 		   (unsigned long int) survey->channel_time_busy,
@@ -8553,7 +8558,7 @@ static int survey_handler(struct nl_msg *msg, void *arg)
 		return NL_SKIP;
 	}
 
-	surveyed_freq = nla_get_u32(sinfo[NL80211_SURVEY_INFO_FREQUENCY]);
+	surveyed_freq = KHZ(nla_get_u32(sinfo[NL80211_SURVEY_INFO_FREQUENCY]));
 
 	if (!check_survey_ok(sinfo, surveyed_freq,
 			     survey_results->freq_filter))
@@ -8773,9 +8778,10 @@ static int nl80211_start_radar_detection(void *priv,
 	struct nl_msg *msg;
 	int ret;
 
-	wpa_printf(MSG_DEBUG, "nl80211: Start radar detection (CAC) %d MHz (ht_enabled=%d, vht_enabled=%d, he_enabled=%d, bandwidth=%d MHz, cf1=%d MHz, cf2=%d MHz)",
-		   freq->freq, freq->ht_enabled, freq->vht_enabled, freq->he_enabled,
-		   freq->bandwidth, freq->center_freq1, freq->center_freq2);
+	wpa_printf(MSG_DEBUG, "nl80211: Start radar detection (CAC) %g MHz (ht_enabled=%d, vht_enabled=%d, he_enabled=%d, bandwidth=%d MHz, cf1=%g MHz, cf2=%g MHz)",
+		   PR_KHZ(freq->freq), freq->ht_enabled, freq->vht_enabled,
+		   freq->he_enabled, freq->bandwidth,
+		   PR_KHZ(freq->center_freq1), PR_KHZ(freq->center_freq2));
 
 	if (!(drv->capa.flags & WPA_DRIVER_FLAGS_RADAR)) {
 		wpa_printf(MSG_DEBUG, "nl80211: Driver does not support radar "
@@ -8784,7 +8790,7 @@ static int nl80211_start_radar_detection(void *priv,
 	}
 
 	if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_RADAR_DETECT)) ||
-	    nl80211_put_freq_params(msg, freq) < 0) {
+	    nl80211_put_freq_params(msg, drv->capa.flags, freq) < 0) {
 		nlmsg_free(msg);
 		return -1;
 	}
@@ -8908,13 +8914,13 @@ nl80211_tdls_enable_channel_switch(void *priv, const u8 *addr, u8 oper_class,
 		return -EOPNOTSUPP;
 
 	wpa_printf(MSG_DEBUG, "nl80211: Enable TDLS channel switch " MACSTR
-		   " oper_class=%u freq=%u",
-		   MAC2STR(addr), oper_class, params->freq);
+		   " oper_class=%u freq=%g",
+		   MAC2STR(addr), oper_class, PR_KHZ(params->freq));
 	msg = nl80211_cmd_msg(bss, 0, NL80211_CMD_TDLS_CHANNEL_SWITCH);
 	if (!msg ||
 	    nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr) ||
 	    nla_put_u8(msg, NL80211_ATTR_OPER_CLASS, oper_class) ||
-	    (ret = nl80211_put_freq_params(msg, params))) {
+	    (ret = nl80211_put_freq_params(msg, drv->capa.flags, params))) {
 		nlmsg_free(msg);
 		wpa_printf(MSG_DEBUG, "nl80211: Could not build TDLS chan switch");
 		return ret;
@@ -9182,13 +9188,13 @@ static int wpa_driver_nl80211_status(void *priv, char *buf, size_t buflen)
 			  "ifname=%s\n"
 			  "brname=%s\n"
 			  "addr=" MACSTR "\n"
-			  "freq=%d\n"
+			  "freq=%g\n"
 			  "%s%s%s%s%s%s",
 			  bss->ifindex,
 			  bss->ifname,
 			  bss->brname,
 			  MAC2STR(bss->addr),
-			  bss->freq,
+			  PR_KHZ(bss->freq),
 			  bss->beacon_set ? "beacon_set=1\n" : "",
 			  bss->added_if_into_bridge ?
 			  "added_if_into_bridge=1\n" : "",
@@ -9219,7 +9225,7 @@ static int wpa_driver_nl80211_status(void *priv, char *buf, size_t buflen)
 			  "bssid=" MACSTR "\n"
 			  "prev_bssid=" MACSTR "\n"
 			  "associated=%d\n"
-			  "assoc_freq=%u\n"
+			  "assoc_freq=%g\n"
 			  "monitor_sock=%d\n"
 			  "monitor_ifidx=%d\n"
 			  "monitor_refcount=%d\n"
@@ -9236,7 +9242,7 @@ static int wpa_driver_nl80211_status(void *priv, char *buf, size_t buflen)
 			  MAC2STR(drv->bssid),
 			  MAC2STR(drv->prev_bssid),
 			  drv->associated,
-			  drv->assoc_freq,
+			  PR_KHZ(drv->assoc_freq),
 			  drv->monitor_sock,
 			  drv->monitor_ifidx,
 			  drv->monitor_refcount,
@@ -9374,11 +9380,11 @@ static int nl80211_switch_channel(void *priv, struct csa_settings *settings)
 	int csa_off_len = 0;
 	int i;
 
-	wpa_printf(MSG_DEBUG, "nl80211: Channel switch request (cs_count=%u block_tx=%u freq=%d width=%d cf1=%d cf2=%d)",
+	wpa_printf(MSG_DEBUG, "nl80211: Channel switch request (cs_count=%u block_tx=%u freq=%g width=%d cf1=%g cf2=%g)",
 		   settings->cs_count, settings->block_tx,
-		   settings->freq_params.freq, settings->freq_params.bandwidth,
-		   settings->freq_params.center_freq1,
-		   settings->freq_params.center_freq2);
+		   PR_KHZ(settings->freq_params.freq), settings->freq_params.bandwidth,
+		   PR_KHZ(settings->freq_params.center_freq1),
+		   PR_KHZ(settings->freq_params.center_freq2));
 
 	if (!(drv->capa.flags & WPA_DRIVER_FLAGS_AP_CSA)) {
 		wpa_printf(MSG_DEBUG, "nl80211: Driver does not support channel switch command");
@@ -9444,7 +9450,7 @@ static int nl80211_switch_channel(void *priv, struct csa_settings *settings)
 	if (!(msg = nl80211_bss_msg(bss, 0, NL80211_CMD_CHANNEL_SWITCH)) ||
 	    nla_put_u32(msg, NL80211_ATTR_CH_SWITCH_COUNT,
 			settings->cs_count) ||
-	    (ret = nl80211_put_freq_params(msg, &settings->freq_params)) ||
+	    (ret = nl80211_put_freq_params(msg, drv->capa.flags, &settings->freq_params)) ||
 	    (settings->block_tx &&
 	     nla_put_flag(msg, NL80211_ATTR_CH_SWITCH_BLOCK_TX)))
 		goto error;
@@ -10042,7 +10048,7 @@ static int nl80211_join_mesh(struct i802_bss *bss,
 	wpa_printf(MSG_DEBUG, "nl80211: mesh join (ifindex=%d)", drv->ifindex);
 	msg = nl80211_drv_msg(drv, 0, NL80211_CMD_JOIN_MESH);
 	if (!msg ||
-	    nl80211_put_freq_params(msg, &params->freq) ||
+	    nl80211_put_freq_params(msg, drv->capa.flags, &params->freq) ||
 	    nl80211_put_basic_rates(msg, params->basic_rates) ||
 	    nl80211_put_mesh_id(msg, params->meshid, params->meshid_len) ||
 	    nl80211_put_beacon_int(msg, params->beacon_int) ||
@@ -10508,8 +10514,8 @@ static int add_acs_ch_list(struct nl_msg *msg, const int *freq_list)
 		 * QCA_WLAN_VENDOR_ATTR_ACS_CH_LIST to maintain backwards
 		 * compatibility.
 		 */
-		if (!(freq >= 2412 && freq <= 2484) &&
-		    !(freq >= 5180 && freq <= 5900))
+		if (!(freq >= KHZ(2412) && freq <= KHZ(2484)) &&
+		    !(freq >= KHZ(5180) && freq <= KHZ(5900)))
 			continue;
 		hw_mode = ieee80211_freq_to_chan(freq, &ch_list[num_channels]);
 		if (hw_mode != NUM_HOSTAPD_MODES)
@@ -10537,7 +10543,7 @@ static int add_acs_freq_list(struct nl_msg *msg, const int *freq_list)
 	if (!freqs)
 		return -1;
 	for (i = 0; i < len; i++)
-		freqs[i] = freq_list[i];
+		freqs[i] = MHZ(freq_list[i]);
 	ret = nla_put(msg, QCA_WLAN_VENDOR_ATTR_ACS_FREQ_LIST,
 		      sizeof(u32) * len, freqs);
 	os_free(freqs);
@@ -10843,8 +10849,8 @@ static int nl80211_p2p_lo_start(void *priv, unsigned int freq,
 	int ret;
 
 	wpa_printf(MSG_DEBUG,
-		   "nl80211: Start P2P Listen offload: freq=%u, period=%u, interval=%u, count=%u",
-		   freq, period, interval, count);
+		   "nl80211: Start P2P Listen offload: freq=%g, period=%u, interval=%u, count=%u",
+		   PR_KHZ(freq), period, interval, count);
 
 	if (!(drv->capa.flags & WPA_DRIVER_FLAGS_P2P_LISTEN_OFFLOAD))
 		return -1;
diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
index b9eb6e220d63..f26bd45df6f9 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -1500,16 +1500,18 @@ static void phy_info_freq(struct hostapd_hw_modes *mode,
 	u8 channel;
 
 	os_memset(chan, 0, sizeof(*chan));
-	chan->freq = nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_FREQ]);
+
+	chan->freq = KHZ(nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_FREQ]));
 	chan->flag = 0;
 	chan->allowed_bw = ~0;
 	chan->dfs_cac_ms = 0;
+
 	if (ieee80211_freq_to_chan(chan->freq, &channel) != NUM_HOSTAPD_MODES)
 		chan->chan = channel;
 	else
 		wpa_printf(MSG_DEBUG,
-			   "nl80211: No channel number found for frequency %u MHz",
-			   chan->freq);
+			   "nl80211: No channel number found for frequency %g MHz",
+			   PR_KHZ(chan->freq));
 
 	if (tb_freq[NL80211_FREQUENCY_ATTR_DISABLED])
 		chan->flag |= HOSTAPD_CHAN_DISABLED;
@@ -1939,7 +1941,7 @@ wpa_driver_nl80211_postprocess_modes(struct hostapd_hw_modes *modes,
 	for (m = 0; m < *num_modes; m++) {
 		if (!modes[m].num_channels)
 			continue;
-		if (modes[m].channels[0].freq < 4000) {
+		if (modes[m].channels[0].freq < KHZ(4000)) {
 			modes[m].mode = HOSTAPD_MODE_IEEE80211B;
 			for (i = 0; i < modes[m].num_rates; i++) {
 				if (modes[m].rates[i] > 200) {
@@ -1947,7 +1949,7 @@ wpa_driver_nl80211_postprocess_modes(struct hostapd_hw_modes *modes,
 					break;
 				}
 			}
-		} else if (modes[m].channels[0].freq > 50000)
+		} else if (modes[m].channels[0].freq > KHZ(50000))
 			modes[m].mode = HOSTAPD_MODE_IEEE80211AD;
 		else
 			modes[m].mode = HOSTAPD_MODE_IEEE80211A;
@@ -2026,7 +2028,8 @@ static void nl80211_set_ht40_mode(struct hostapd_hw_modes *mode, int start,
 
 	for (c = 0; c < mode->num_channels; c++) {
 		struct hostapd_channel_data *chan = &mode->channels[c];
-		if (chan->freq - 10 >= start && chan->freq + 10 <= end)
+		if (chan->freq - KHZ(10) >= start &&
+		    chan->freq + KHZ(10) <= end)
 			chan->flag |= HOSTAPD_CHAN_HT40;
 	}
 }
@@ -2041,9 +2044,11 @@ static void nl80211_set_ht40_mode_sec(struct hostapd_hw_modes *mode, int start,
 		struct hostapd_channel_data *chan = &mode->channels[c];
 		if (!(chan->flag & HOSTAPD_CHAN_HT40))
 			continue;
-		if (chan->freq - 30 >= start && chan->freq - 10 <= end)
+		if (chan->freq - KHZ(30) >= start &&
+		    chan->freq - KHZ(10) <= end)
 			chan->flag |= HOSTAPD_CHAN_HT40MINUS;
-		if (chan->freq + 10 >= start && chan->freq + 30 <= end)
+		if (chan->freq + KHZ(10) >= start &&
+		    chan->freq + KHZ(30) <= end)
 			chan->flag |= HOSTAPD_CHAN_HT40PLUS;
 	}
 }
@@ -2060,8 +2065,8 @@ static void nl80211_reg_rule_max_eirp(u32 start, u32 end, u32 max_eirp,
 
 		for (c = 0; c < mode->num_channels; c++) {
 			struct hostapd_channel_data *chan = &mode->channels[c];
-			if ((u32) chan->freq - 10 >= start &&
-			    (u32) chan->freq + 10 <= end)
+			if ((u32) chan->freq - KHZ(10) >= start &&
+			    (u32) chan->freq + KHZ(10) <= end)
 				chan->max_tx_power = max_eirp;
 		}
 	}
@@ -2093,8 +2098,8 @@ static void nl80211_reg_rule_sec(struct nlattr *tb[],
 	    tb[NL80211_ATTR_FREQ_RANGE_MAX_BW] == NULL)
 		return;
 
-	start = nla_get_u32(tb[NL80211_ATTR_FREQ_RANGE_START]) / 1000;
-	end = nla_get_u32(tb[NL80211_ATTR_FREQ_RANGE_END]) / 1000;
+	start = nla_get_u32(tb[NL80211_ATTR_FREQ_RANGE_START]);
+	end = nla_get_u32(tb[NL80211_ATTR_FREQ_RANGE_END]);
 	max_bw = nla_get_u32(tb[NL80211_ATTR_FREQ_RANGE_MAX_BW]) / 1000;
 
 	if (max_bw < 20)
@@ -2116,41 +2121,53 @@ static void nl80211_set_vht_mode(struct hostapd_hw_modes *mode, int start,
 
 	for (c = 0; c < mode->num_channels; c++) {
 		struct hostapd_channel_data *chan = &mode->channels[c];
-		if (chan->freq - 10 >= start && chan->freq + 70 <= end)
+		if (chan->freq - KHZ(10) >= start &&
+		    chan->freq + KHZ(70) <= end)
 			chan->flag |= HOSTAPD_CHAN_VHT_10_70;
 
-		if (chan->freq - 30 >= start && chan->freq + 50 <= end)
+		if (chan->freq - KHZ(30) >= start &&
+		    chan->freq + KHZ(50) <= end)
 			chan->flag |= HOSTAPD_CHAN_VHT_30_50;
 
-		if (chan->freq - 50 >= start && chan->freq + 30 <= end)
+		if (chan->freq - KHZ(50) >= start &&
+		    chan->freq + KHZ(30) <= end)
 			chan->flag |= HOSTAPD_CHAN_VHT_50_30;
 
-		if (chan->freq - 70 >= start && chan->freq + 10 <= end)
+		if (chan->freq - KHZ(70) >= start &&
+		    chan->freq + KHZ(10) <= end)
 			chan->flag |= HOSTAPD_CHAN_VHT_70_10;
 
 		if (max_bw >= 160) {
-			if (chan->freq - 10 >= start && chan->freq + 150 <= end)
+			if (chan->freq - KHZ(10) >= start &&
+			    chan->freq + KHZ(150) <= end)
 				chan->flag |= HOSTAPD_CHAN_VHT_10_150;
 
-			if (chan->freq - 30 >= start && chan->freq + 130 <= end)
+			if (chan->freq - KHZ(30) >= start &&
+			    chan->freq + KHZ(130) <= end)
 				chan->flag |= HOSTAPD_CHAN_VHT_30_130;
 
-			if (chan->freq - 50 >= start && chan->freq + 110 <= end)
+			if (chan->freq - KHZ(50) >= start &&
+			    chan->freq + KHZ(110) <= end)
 				chan->flag |= HOSTAPD_CHAN_VHT_50_110;
 
-			if (chan->freq - 70 >= start && chan->freq + 90 <= end)
+			if (chan->freq - KHZ(70) >= start &&
+			    chan->freq + KHZ(90) <= end)
 				chan->flag |= HOSTAPD_CHAN_VHT_70_90;
 
-			if (chan->freq - 90 >= start && chan->freq + 70 <= end)
+			if (chan->freq - KHZ(90) >= start &&
+			    chan->freq + KHZ(70) <= end)
 				chan->flag |= HOSTAPD_CHAN_VHT_90_70;
 
-			if (chan->freq - 110 >= start && chan->freq + 50 <= end)
+			if (chan->freq - KHZ(110) >= start &&
+			    chan->freq + KHZ(50) <= end)
 				chan->flag |= HOSTAPD_CHAN_VHT_110_50;
 
-			if (chan->freq - 130 >= start && chan->freq + 30 <= end)
+			if (chan->freq - KHZ(130) >= start &&
+			    chan->freq + KHZ(30) <= end)
 				chan->flag |= HOSTAPD_CHAN_VHT_130_30;
 
-			if (chan->freq - 150 >= start && chan->freq + 10 <= end)
+			if (chan->freq - KHZ(150) >= start &&
+			    chan->freq + KHZ(10) <= end)
 				chan->flag |= HOSTAPD_CHAN_VHT_150_10;
 		}
 	}
@@ -2168,8 +2185,8 @@ static void nl80211_reg_rule_vht(struct nlattr *tb[],
 	    tb[NL80211_ATTR_FREQ_RANGE_MAX_BW] == NULL)
 		return;
 
-	start = nla_get_u32(tb[NL80211_ATTR_FREQ_RANGE_START]) / 1000;
-	end = nla_get_u32(tb[NL80211_ATTR_FREQ_RANGE_END]) / 1000;
+	start = nla_get_u32(tb[NL80211_ATTR_FREQ_RANGE_START]);
+	end = nla_get_u32(tb[NL80211_ATTR_FREQ_RANGE_END]);
 	max_bw = nla_get_u32(tb[NL80211_ATTR_FREQ_RANGE_MAX_BW]) / 1000;
 
 	if (max_bw < 80)
@@ -2265,8 +2282,8 @@ static int nl80211_get_reg(struct nl_msg *msg, void *arg)
 		if (tb_rule[NL80211_ATTR_FREQ_RANGE_START] == NULL ||
 		    tb_rule[NL80211_ATTR_FREQ_RANGE_END] == NULL)
 			continue;
-		start = nla_get_u32(tb_rule[NL80211_ATTR_FREQ_RANGE_START]) / 1000;
-		end = nla_get_u32(tb_rule[NL80211_ATTR_FREQ_RANGE_END]) / 1000;
+		start = nla_get_u32(tb_rule[NL80211_ATTR_FREQ_RANGE_START]);
+		end = nla_get_u32(tb_rule[NL80211_ATTR_FREQ_RANGE_END]);
 		if (tb_rule[NL80211_ATTR_POWER_RULE_MAX_EIRP])
 			max_eirp = nla_get_u32(tb_rule[NL80211_ATTR_POWER_RULE_MAX_EIRP]) / 100;
 		if (tb_rule[NL80211_ATTR_FREQ_RANGE_MAX_BW])
@@ -2274,8 +2291,8 @@ static int nl80211_get_reg(struct nl_msg *msg, void *arg)
 		if (tb_rule[NL80211_ATTR_REG_RULE_FLAGS])
 			flags = nla_get_u32(tb_rule[NL80211_ATTR_REG_RULE_FLAGS]);
 
-		wpa_printf(MSG_DEBUG, "nl80211: %u-%u @ %u MHz %u mBm%s%s%s%s%s%s%s%s",
-			   start, end, max_bw, max_eirp,
+		wpa_printf(MSG_DEBUG, "nl80211: %g-%g @ %u MHz %u mBm%s%s%s%s%s%s%s%s",
+			   PR_KHZ(start), PR_KHZ(end), max_bw, max_eirp,
 			   flags & NL80211_RRF_NO_OFDM ? " (no OFDM)" : "",
 			   flags & NL80211_RRF_NO_CCK ? " (no CCK)" : "",
 			   flags & NL80211_RRF_NO_INDOOR ? " (no indoor)" : "",
@@ -2366,8 +2383,8 @@ static void nl80211_dump_chan_list(struct hostapd_hw_modes *modes,
 		for (j = 0; j < mode->num_channels; j++) {
 			struct hostapd_channel_data *chan = &mode->channels[j];
 
-			res = os_snprintf(pos, end - pos, " %d%s%s%s",
-					  chan->freq,
+			res = os_snprintf(pos, end - pos, " %g%s%s%s",
+					  PR_KHZ(chan->freq),
 					  (chan->flag & HOSTAPD_CHAN_DISABLED) ?
 					  "[DISABLED]" : "",
 					  (chan->flag & HOSTAPD_CHAN_NO_IR) ?
diff --git a/src/drivers/driver_nl80211_event.c b/src/drivers/driver_nl80211_event.c
index 6a2de1f3c211..430bf7ddbb79 100644
--- a/src/drivers/driver_nl80211_event.c
+++ b/src/drivers/driver_nl80211_event.c
@@ -591,15 +591,15 @@ static void mlme_event_ch_switch(struct wpa_driver_nl80211_data *drv,
 	}
 
 	os_memset(&data, 0, sizeof(data));
-	data.ch_switch.freq = nla_get_u32(freq);
+	data.ch_switch.freq = KHZ(nla_get_u32(freq));
 	data.ch_switch.ht_enabled = ht_enabled;
 	data.ch_switch.ch_offset = chan_offset;
 	if (bw)
 		data.ch_switch.ch_width = convert2width(nla_get_u32(bw));
 	if (cf1)
-		data.ch_switch.cf1 = nla_get_u32(cf1);
+		data.ch_switch.cf1 = KHZ(nla_get_u32(cf1));
 	if (cf2)
-		data.ch_switch.cf2 = nla_get_u32(cf2);
+		data.ch_switch.cf2 = KHZ(nla_get_u32(cf2));
 
 	if (finished)
 		bss->freq = data.ch_switch.freq;
@@ -661,14 +661,14 @@ static void mlme_event_mgmt(struct i802_bss *bss,
 
 	os_memset(&event, 0, sizeof(event));
 	if (freq) {
-		event.rx_mgmt.freq = nla_get_u32(freq);
+		event.rx_mgmt.freq = KHZ(nla_get_u32(freq));
 		rx_freq = drv->last_mgmt_freq = event.rx_mgmt.freq;
 	}
 	wpa_printf(MSG_DEBUG,
 		   "nl80211: RX frame da=" MACSTR " sa=" MACSTR " bssid=" MACSTR
-		   " freq=%d ssi_signal=%d fc=0x%x seq_ctrl=0x%x stype=%u (%s) len=%u",
+		   " freq=%g ssi_signal=%d fc=0x%x seq_ctrl=0x%x stype=%u (%s) len=%u",
 		   MAC2STR(mgmt->da), MAC2STR(mgmt->sa), MAC2STR(mgmt->bssid),
-		   rx_freq, ssi_signal, fc,
+		   PR_KHZ(rx_freq), ssi_signal, fc,
 		   le_to_host16(mgmt->seq_ctrl), stype, fc2str(fc),
 		   (unsigned int) len);
 	event.rx_mgmt.frame = frame;
@@ -1056,8 +1056,8 @@ static void mlme_event_join_ibss(struct wpa_driver_nl80211_data *drv,
 
 	freq = nl80211_get_assoc_freq(drv);
 	if (freq) {
-		wpa_printf(MSG_DEBUG, "nl80211: IBSS on frequency %u MHz",
-			   freq);
+		wpa_printf(MSG_DEBUG, "nl80211: IBSS on frequency %g MHz",
+			   PR_KHZ(freq));
 		drv->first_bss->freq = freq;
 	}
 
@@ -1076,7 +1076,7 @@ static void mlme_event_remain_on_channel(struct wpa_driver_nl80211_data *drv,
 	u64 cookie;
 
 	if (tb[NL80211_ATTR_WIPHY_FREQ])
-		freq = nla_get_u32(tb[NL80211_ATTR_WIPHY_FREQ]);
+		freq = KHZ(nla_get_u32(tb[NL80211_ATTR_WIPHY_FREQ]));
 	else
 		freq = 0;
 
@@ -1096,8 +1096,8 @@ static void mlme_event_remain_on_channel(struct wpa_driver_nl80211_data *drv,
 		cookie = 0;
 
 	wpa_printf(MSG_DEBUG, "nl80211: Remain-on-channel event (cancel=%d "
-		   "freq=%u channel_type=%u duration=%u cookie=0x%llx (%s))",
-		   cancel_event, freq, chan_type, duration,
+		   "freq=%g channel_type=%u duration=%u cookie=0x%llx (%s))",
+		   cancel_event, PR_KHZ(freq), chan_type, duration,
 		   (long long unsigned int) cookie,
 		   cookie == drv->remain_on_chan_cookie ? "match" : "unknown");
 
@@ -1622,7 +1622,7 @@ static void nl80211_radar_event(struct wpa_driver_nl80211_data *drv,
 		return;
 
 	os_memset(&data, 0, sizeof(data));
-	data.dfs_event.freq = nla_get_u32(tb[NL80211_ATTR_WIPHY_FREQ]);
+	data.dfs_event.freq = KHZ(nla_get_u32(tb[NL80211_ATTR_WIPHY_FREQ]));
 	event_type = nla_get_u32(tb[NL80211_ATTR_RADAR_EVENT]);
 
 	/* Check HT params */
@@ -1651,14 +1651,16 @@ static void nl80211_radar_event(struct wpa_driver_nl80211_data *drv,
 			convert2width(nla_get_u32(
 					      tb[NL80211_ATTR_CHANNEL_WIDTH]));
 	if (tb[NL80211_ATTR_CENTER_FREQ1])
-		data.dfs_event.cf1 = nla_get_u32(tb[NL80211_ATTR_CENTER_FREQ1]);
+		data.dfs_event.cf1 =
+			KHZ(nla_get_u32(tb[NL80211_ATTR_CENTER_FREQ1]));
 	if (tb[NL80211_ATTR_CENTER_FREQ2])
-		data.dfs_event.cf2 = nla_get_u32(tb[NL80211_ATTR_CENTER_FREQ2]);
+		data.dfs_event.cf2 =
+			KHZ(nla_get_u32(tb[NL80211_ATTR_CENTER_FREQ2]));
 
-	wpa_printf(MSG_DEBUG, "nl80211: DFS event on freq %d MHz, ht: %d, offset: %d, width: %d, cf1: %dMHz, cf2: %dMHz",
-		   data.dfs_event.freq, data.dfs_event.ht_enabled,
+	wpa_printf(MSG_DEBUG, "nl80211: DFS event on freq %g MHz, ht: %d, offset: %d, width: %d, cf1: %gMHz, cf2: %gMHz",
+		   PR_KHZ(data.dfs_event.freq), data.dfs_event.ht_enabled,
 		   data.dfs_event.chan_offset, data.dfs_event.chan_width,
-		   data.dfs_event.cf1, data.dfs_event.cf2);
+		   PR_KHZ(data.dfs_event.cf1), PR_KHZ(data.dfs_event.cf2));
 
 	switch (event_type) {
 	case NL80211_RADAR_DETECTED:
@@ -1737,10 +1739,10 @@ static void qca_nl80211_avoid_freq(struct wpa_driver_nl80211_data *drv,
 	os_memset(&event, 0, sizeof(event));
 	for (i = 0; i < count; i++) {
 		unsigned int idx = event.freq_range.num;
-		range[idx].min = freq_range->range[i].start_freq;
-		range[idx].max = freq_range->range[i].end_freq;
-		wpa_printf(MSG_DEBUG, "nl80211: Avoid frequency range: %u-%u",
-			   range[idx].min, range[idx].max);
+		range[idx].min = KHZ(freq_range->range[i].start_freq);
+		range[idx].max = KHZ(freq_range->range[i].end_freq);
+		wpa_printf(MSG_DEBUG, "nl80211: Avoid frequency range: %g-%g",
+			   PR_KHZ(range[idx].min), PR_KHZ(range[idx].max));
 		if (range[idx].min > range[idx].max) {
 			wpa_printf(MSG_DEBUG, "nl80211: Ignore invalid frequency range");
 			continue;
@@ -1961,7 +1963,7 @@ static void qca_nl80211_dfs_offload_radar_event(
 	}
 
 	os_memset(&data, 0, sizeof(data));
-	data.dfs_event.freq = nla_get_u32(tb[NL80211_ATTR_WIPHY_FREQ]);
+	data.dfs_event.freq = KHZ(nla_get_u32(tb[NL80211_ATTR_WIPHY_FREQ]));
 
 	wpa_printf(MSG_DEBUG, "nl80211: DFS event on freq %d MHz",
 		   data.dfs_event.freq);
@@ -1992,9 +1994,11 @@ static void qca_nl80211_dfs_offload_radar_event(
 			convert2width(nla_get_u32(
 					      tb[NL80211_ATTR_CHANNEL_WIDTH]));
 	if (tb[NL80211_ATTR_CENTER_FREQ1])
-		data.dfs_event.cf1 = nla_get_u32(tb[NL80211_ATTR_CENTER_FREQ1]);
+		data.dfs_event.cf1 =
+			KHZ(nla_get_u32(tb[NL80211_ATTR_CENTER_FREQ1]));
 	if (tb[NL80211_ATTR_CENTER_FREQ2])
-		data.dfs_event.cf2 = nla_get_u32(tb[NL80211_ATTR_CENTER_FREQ2]);
+		data.dfs_event.cf2 =
+			KHZ(nla_get_u32(tb[NL80211_ATTR_CENTER_FREQ2]));
 
 	wpa_printf(MSG_DEBUG, "nl80211: DFS event on freq %d MHz, ht: %d, "
 		    "offset: %d, width: %d, cf1: %dMHz, cf2: %dMHz",
@@ -2100,7 +2104,7 @@ static void send_vendor_scan_event(struct wpa_driver_nl80211_data *drv,
 		nla_for_each_nested(nl,
 				    tb[QCA_WLAN_VENDOR_ATTR_SCAN_FREQUENCIES],
 				    rem) {
-			freqs[num_freqs] = nla_get_u32(nl);
+			freqs[num_freqs] = KHZ(nla_get_u32(nl));
 			res = os_snprintf(pos, end - pos, " %d",
 					  freqs[num_freqs]);
 			if (!os_snprintf_error(end - pos, res))
@@ -2353,14 +2357,14 @@ static void nl80211_dump_freq(const char *title, struct nlattr *nl_freq)
 		  nla_data(nl_freq), nla_len(nl_freq), freq_policy);
 
 	if (tb[NL80211_FREQUENCY_ATTR_FREQ])
-		freq = nla_get_u32(tb[NL80211_FREQUENCY_ATTR_FREQ]);
+		freq = KHZ(nla_get_u32(tb[NL80211_FREQUENCY_ATTR_FREQ]));
 	if (tb[NL80211_FREQUENCY_ATTR_MAX_TX_POWER])
 		max_tx_power =
 			nla_get_u32(tb[NL80211_FREQUENCY_ATTR_MAX_TX_POWER]);
 
 	wpa_printf(MSG_DEBUG,
-		   "nl80211: Channel (%s): freq=%u max_tx_power=%u%s%s%s",
-		   title, freq, max_tx_power,
+		   "nl80211: Channel (%s): freq=%g max_tx_power=%u%s%s%s",
+		   title, PR_KHZ(freq), max_tx_power,
 		   tb[NL80211_FREQUENCY_ATTR_DISABLED] ? " disabled" : "",
 		   tb[NL80211_FREQUENCY_ATTR_NO_IR] ? " no-IR" : "",
 		   tb[NL80211_FREQUENCY_ATTR_RADAR] ? " radar" : "");
@@ -2656,7 +2660,8 @@ static void do_process_drv_event(struct i802_bss *bss, int cmd,
 	case NL80211_CMD_UNPROT_DISASSOCIATE:
 		mlme_event(bss, cmd, tb[NL80211_ATTR_FRAME],
 			   tb[NL80211_ATTR_MAC], tb[NL80211_ATTR_TIMED_OUT],
-			   tb[NL80211_ATTR_WIPHY_FREQ], tb[NL80211_ATTR_ACK],
+			   tb[NL80211_ATTR_WIPHY_FREQ],
+			   tb[NL80211_ATTR_ACK],
 			   tb[NL80211_ATTR_COOKIE],
 			   tb[NL80211_ATTR_RX_SIGNAL_DBM],
 			   tb[NL80211_ATTR_STA_WME],
@@ -2850,7 +2855,8 @@ int process_bss_event(struct nl_msg *msg, void *arg)
 	case NL80211_CMD_FRAME_TX_STATUS:
 		mlme_event(bss, gnlh->cmd, tb[NL80211_ATTR_FRAME],
 			   tb[NL80211_ATTR_MAC], tb[NL80211_ATTR_TIMED_OUT],
-			   tb[NL80211_ATTR_WIPHY_FREQ], tb[NL80211_ATTR_ACK],
+			   tb[NL80211_ATTR_WIPHY_FREQ],
+			   tb[NL80211_ATTR_ACK],
 			   tb[NL80211_ATTR_COOKIE],
 			   tb[NL80211_ATTR_RX_SIGNAL_DBM],
 			   tb[NL80211_ATTR_STA_WME], NULL);
diff --git a/src/drivers/driver_nl80211_scan.c b/src/drivers/driver_nl80211_scan.c
index dc91a2901aab..44c6a8ef312e 100644
--- a/src/drivers/driver_nl80211_scan.c
+++ b/src/drivers/driver_nl80211_scan.c
@@ -220,9 +220,9 @@ nl80211_scan_common(struct i802_bss *bss, u8 cmd,
 		if (freqs == NULL)
 			goto fail;
 		for (i = 0; params->freqs[i]; i++) {
-			wpa_printf(MSG_MSGDUMP, "nl80211: Scan frequency %u "
-				   "MHz", params->freqs[i]);
-			if (nla_put_u32(msg, i + 1, params->freqs[i]))
+			wpa_printf(MSG_MSGDUMP, "nl80211: Scan frequency %g "
+				   "MHz", PR_KHZ(params->freqs[i]));
+			if (nla_put_u32(msg, i + 1, MHZ(params->freqs[i])))
 				goto fail;
 		}
 		nla_nest_end(msg, freqs);
@@ -754,7 +754,7 @@ nl80211_parse_bss_info(struct wpa_driver_nl80211_data *drv,
 		os_memcpy(r->bssid, nla_data(bss[NL80211_BSS_BSSID]),
 			  ETH_ALEN);
 	if (bss[NL80211_BSS_FREQUENCY])
-		r->freq = nla_get_u32(bss[NL80211_BSS_FREQUENCY]);
+		r->freq = KHZ(nla_get_u32(bss[NL80211_BSS_FREQUENCY]));
 	if (bss[NL80211_BSS_BEACON_INTERVAL])
 		r->beacon_int = nla_get_u16(bss[NL80211_BSS_BEACON_INTERVAL]);
 	if (bss[NL80211_BSS_CAPABILITY])
@@ -1141,9 +1141,9 @@ int wpa_driver_nl80211_vendor_scan(struct i802_bss *bss,
 			goto fail;
 		for (i = 0; params->freqs[i]; i++) {
 			wpa_printf(MSG_MSGDUMP,
-				   "nl80211: Scan frequency %u MHz",
-				   params->freqs[i]);
-			if (nla_put_u32(msg, i + 1, params->freqs[i]))
+				   "nl80211: Scan frequency %g MHz",
+				   PR_KHZ(params->freqs[i]));
+			if (nla_put_u32(msg, i + 1, MHZ(params->freqs[i])))
 				goto fail;
 		}
 		nla_nest_end(msg, freqs);
diff --git a/src/drivers/driver_privsep.c b/src/drivers/driver_privsep.c
index d6735b49c4af..4845c7039866 100644
--- a/src/drivers/driver_privsep.c
+++ b/src/drivers/driver_privsep.c
@@ -254,9 +254,9 @@ static int wpa_driver_privsep_authenticate(
 	size_t buflen;
 	u8 *pos;
 
-	wpa_printf(MSG_DEBUG, "%s: priv=%p freq=%d bssid=" MACSTR
+	wpa_printf(MSG_DEBUG, "%s: priv=%p freq=%g bssid=" MACSTR
 		   " auth_alg=%d local_state_change=%d p2p=%d",
-		   __func__, priv, params->freq, MAC2STR(params->bssid),
+		   __func__, priv, PR_KHZ(params->freq), MAC2STR(params->bssid),
 		   params->auth_alg, params->local_state_change, params->p2p);
 
 	buflen = sizeof(*data) + params->ie_len + params->auth_data_len;
@@ -303,11 +303,11 @@ static int wpa_driver_privsep_associate(
 	int res;
 	size_t buflen;
 
-	wpa_printf(MSG_DEBUG, "%s: priv=%p freq=%d pairwise_suite=%d "
+	wpa_printf(MSG_DEBUG, "%s: priv=%p freq=%g pairwise_suite=%d "
 		   "group_suite=%d key_mgmt_suite=%d auth_alg=%d mode=%d",
-		   __func__, priv, params->freq.freq, params->pairwise_suite,
-		   params->group_suite, params->key_mgmt_suite,
-		   params->auth_alg, params->mode);
+		   __func__, priv, PR_KHZ(params->freq.freq),
+		   params->pairwise_suite, params->group_suite,
+		   params->key_mgmt_suite, params->auth_alg, params->mode);
 
 	buflen = sizeof(*data) + params->wpa_ie_len;
 	data = os_zalloc(buflen);
diff --git a/src/drivers/driver_wext.c b/src/drivers/driver_wext.c
index 0f0ad1f537fa..ee4df1d7bc0b 100644
--- a/src/drivers/driver_wext.c
+++ b/src/drivers/driver_wext.c
@@ -2210,7 +2210,7 @@ int wpa_driver_wext_associate(void *priv,
 	if (wpa_driver_wext_set_auth_param(drv, IW_AUTH_MFP, value) < 0)
 		ret = -1;
 	if (params->freq.freq &&
-	    wpa_driver_wext_set_freq(drv, params->freq.freq) < 0)
+	    wpa_driver_wext_set_freq(drv, MHZ(params->freq.freq)) < 0)
 		ret = -1;
 	if (!drv->cfg80211 &&
 	    wpa_driver_wext_set_ssid(drv, params->ssid, params->ssid_len) < 0)
diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
index 605feb24f851..c27cc65deef9 100644
--- a/src/eap_peer/eap_pwd.c
+++ b/src/eap_peer/eap_pwd.c
@@ -151,7 +151,7 @@ static void * eap_pwd_init(struct eap_sm *sm)
 				os_memcpy(copy, pos, end - pos);
 				pos = copy;
 			}
-			res = freq_range_list_parse(&data->allowed_groups, pos);
+			res = int_range_list_parse(&data->allowed_groups, pos);
 			os_free(copy);
 			if (res)
 				goto fail;
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index b7a5eae3540e..6d075863a57e 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -795,25 +795,25 @@ int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq,
 		dev->info.p2ps_instance = wpabuf_alloc_copy(
 			msg.adv_service_instance, msg.adv_service_instance_len);
 
-	if (freq >= 2412 && freq <= 2484 && msg.ds_params &&
+	if (freq >= KHZ(2412) && freq <= KHZ(2484) && msg.ds_params &&
 	    *msg.ds_params >= 1 && *msg.ds_params <= 14) {
 		int ds_freq;
 		if (*msg.ds_params == 14)
-			ds_freq = 2484;
+			ds_freq = KHZ(2484);
 		else
-			ds_freq = 2407 + *msg.ds_params * 5;
+			ds_freq = KHZ(2407 + *msg.ds_params * 5);
 		if (freq != ds_freq) {
-			p2p_dbg(p2p, "Update Listen frequency based on DS Parameter Set IE: %d -> %d MHz",
-				freq, ds_freq);
+			p2p_dbg(p2p, "Update Listen frequency based on DS Parameter Set IE: %g -> %g MHz",
+				PR_KHZ(freq), PR_KHZ(ds_freq));
 			freq = ds_freq;
 		}
 	}
 
 	if (dev->listen_freq && dev->listen_freq != freq && scan_res) {
 		p2p_dbg(p2p, "Update Listen frequency based on scan results ("
-			MACSTR " %d -> %d MHz (DS param %d)",
-			MAC2STR(dev->info.p2p_device_addr), dev->listen_freq,
-			freq, msg.ds_params ? *msg.ds_params : -1);
+			MACSTR " %g -> %g MHz (DS param %d)",
+			MAC2STR(dev->info.p2p_device_addr), PR_KHZ(dev->listen_freq),
+			PR_KHZ(freq), msg.ds_params ? *msg.ds_params : -1);
 	}
 	if (scan_res) {
 		dev->listen_freq = freq;
@@ -867,8 +867,8 @@ int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq,
 	     (dev->flags & P2P_DEV_P2PS_REPORTED)))
 		return 0;
 
-	p2p_dbg(p2p, "Peer found with Listen frequency %d MHz (rx_time=%u.%06u)",
-		freq, (unsigned int) rx_time->sec,
+	p2p_dbg(p2p, "Peer found with Listen frequency %g MHz (rx_time=%u.%06u)",
+		PR_KHZ(freq), (unsigned int) rx_time->sec,
 		(unsigned int) rx_time->usec);
 	if (dev->flags & P2P_DEV_USER_REJECTED) {
 		p2p_dbg(p2p, "Do not report rejected device");
@@ -876,7 +876,7 @@ int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq,
 	}
 
 	if (dev->info.config_methods == 0 &&
-	    (freq == 2412 || freq == 2437 || freq == 2462)) {
+	    (freq == KHZ(2412) || freq == KHZ(2437) || freq == KHZ(2462))) {
 		/*
 		 * If we have only seen a Beacon frame from a GO, we do not yet
 		 * know what WPS config methods it supports. Since some
@@ -986,12 +986,12 @@ static int p2p_get_next_prog_freq(struct p2p_data *p2p)
 	}
 
 	freq = p2p_channel_to_freq(reg_class, channel);
-	p2p_dbg(p2p, "Next progressive search channel: reg_class %u channel %u -> %d MHz",
-		reg_class, channel, freq);
+	p2p_dbg(p2p, "Next progressive search channel: reg_class %u channel %u -> %g MHz",
+		reg_class, channel, PR_KHZ(freq));
 	p2p->last_prog_scan_class = reg_class;
 	p2p->last_prog_scan_chan = channel;
 
-	if (freq == 2412 || freq == 2437 || freq == 2462)
+	if (freq == KHZ(2412) || freq == KHZ(2437) || freq == KHZ(2462))
 		return 0; /* No need to add social channels */
 	return freq;
 }
@@ -1021,7 +1021,7 @@ static void p2p_search(struct p2p_data *p2p)
 	    (p2p->find_type == P2P_FIND_START_WITH_FULL &&
 	     (freq = p2p->find_specified_freq) > 0)) {
 		type = P2P_SCAN_SOCIAL_PLUS_ONE;
-		p2p_dbg(p2p, "Starting search (+ freq %u)", freq);
+		p2p_dbg(p2p, "Starting search (+ freq %g)", PR_KHZ(freq));
 	} else {
 		type = P2P_SCAN_SOCIAL;
 		p2p_dbg(p2p, "Starting search");
@@ -1228,7 +1228,8 @@ int p2p_find(struct p2p_data *p2p, unsigned int timeout,
 	p2p->cfg->stop_listen(p2p->cfg->cb_ctx);
 	p2p->find_pending_full = 0;
 	p2p->find_type = type;
-	if (freq != 2412 && freq != 2437 && freq != 2462 && freq != 60480)
+	if (freq != KHZ(2412) && freq != KHZ(2437) && freq != KHZ(2462) &&
+	    freq != KHZ(60480))
 		p2p->find_specified_freq = freq;
 	else
 		p2p->find_specified_freq = 0;
@@ -1366,8 +1367,8 @@ static int p2p_prepare_channel_pref(struct p2p_data *p2p,
 	u8 op_class, op_channel;
 	unsigned int freq = force_freq ? force_freq : pref_freq;
 
-	p2p_dbg(p2p, "Prepare channel pref - force_freq=%u pref_freq=%u go=%d",
-		force_freq, pref_freq, go);
+	p2p_dbg(p2p, "Prepare channel pref - force_freq=%g pref_freq=%g go=%d",
+		PR_KHZ(force_freq), PR_KHZ(pref_freq), go);
 	if (p2p_freq_to_channel(freq, &op_class, &op_channel) < 0) {
 		p2p_dbg(p2p, "Unsupported frequency %u MHz", freq);
 		return -1;
@@ -1376,8 +1377,8 @@ static int p2p_prepare_channel_pref(struct p2p_data *p2p,
 	if (!p2p_channels_includes(&p2p->cfg->channels, op_class, op_channel) &&
 	    (go || !p2p_channels_includes(&p2p->cfg->cli_channels, op_class,
 					  op_channel))) {
-		p2p_dbg(p2p, "Frequency %u MHz (oper_class %u channel %u) not allowed for P2P",
-			freq, op_class, op_channel);
+		p2p_dbg(p2p, "Frequency %g MHz (oper_class %u channel %u) not allowed for P2P",
+			PR_KHZ(freq), op_class, op_channel);
 		return -1;
 	}
 
@@ -1500,8 +1501,8 @@ static void p2p_prepare_channel_best(struct p2p_data *p2p)
 int p2p_prepare_channel(struct p2p_data *p2p, struct p2p_device *dev,
 			unsigned int force_freq, unsigned int pref_freq, int go)
 {
-	p2p_dbg(p2p, "Prepare channel - force_freq=%u pref_freq=%u go=%d",
-		force_freq, pref_freq, go);
+	p2p_dbg(p2p, "Prepare channel - force_freq=%g pref_freq=%g go=%d",
+		PR_KHZ(force_freq), PR_KHZ(pref_freq), go);
 	if (force_freq || pref_freq) {
 		if (p2p_prepare_channel_pref(p2p, force_freq, pref_freq, go) <
 		    0)
@@ -1741,10 +1742,10 @@ void p2p_add_dev_info(struct p2p_data *p2p, const u8 *addr,
 	} else {
 		p2p_dbg(p2p, "Created device entry based on GO Neg Req: "
 			MACSTR " dev_capab=0x%x group_capab=0x%x name='%s' "
-			"listen_freq=%d",
+			"listen_freq=%g",
 			MAC2STR(dev->info.p2p_device_addr),
 			dev->info.dev_capab, dev->info.group_capab,
-			dev->info.device_name, dev->listen_freq);
+			dev->info.device_name, PR_KHZ(dev->listen_freq));
 	}
 
 	dev->flags &= ~P2P_DEV_GROUP_CLIENT_ONLY;
@@ -2089,10 +2090,10 @@ static void p2p_add_dev_from_probe_req(struct p2p_data *p2p, const u8 *addr,
 	p2p_parse_free(&msg);
 
 	p2p_dbg(p2p, "Created device entry based on Probe Req: " MACSTR
-		" dev_capab=0x%x group_capab=0x%x name='%s' listen_freq=%d",
+		" dev_capab=0x%x group_capab=0x%x name='%s' listen_freq=%g",
 		MAC2STR(dev->info.p2p_device_addr), dev->info.dev_capab,
 		dev->info.group_capab, dev->info.device_name,
-		dev->listen_freq);
+		PR_KHZ(dev->listen_freq));
 }
 
 
@@ -3748,10 +3749,11 @@ void p2p_send_action_cb(struct p2p_data *p2p, unsigned int freq, const u8 *dst,
 	enum p2p_pending_action_state state;
 	int success;
 
-	p2p_dbg(p2p, "Action frame TX callback (state=%d freq=%u dst=" MACSTR
+	p2p_dbg(p2p, "Action frame TX callback (state=%d freq=%g dst=" MACSTR
 		" src=" MACSTR " bssid=" MACSTR " result=%d p2p_state=%s)",
-		p2p->pending_action_state, freq, MAC2STR(dst), MAC2STR(src),
-		MAC2STR(bssid), result, p2p_state_txt(p2p->state));
+		p2p->pending_action_state, PR_KHZ(freq), MAC2STR(dst),
+		MAC2STR(src), MAC2STR(bssid), result,
+		p2p_state_txt(p2p->state));
 	success = result == P2P_SEND_ACTION_SUCCESS;
 	state = p2p->pending_action_state;
 	p2p->pending_action_state = P2P_NO_PENDING_ACTION;
@@ -3812,14 +3814,14 @@ void p2p_listen_cb(struct p2p_data *p2p, unsigned int freq,
 	}
 
 	if (freq != p2p->pending_listen_freq) {
-		p2p_dbg(p2p, "Unexpected listen callback for freq=%u duration=%u (pending_listen_freq=%u)",
-			freq, duration, p2p->pending_listen_freq);
+		p2p_dbg(p2p, "Unexpected listen callback for freq=%g duration=%u (pending_listen_freq=%u)",
+			PR_KHZ(freq), duration, p2p->pending_listen_freq);
 		return;
 	}
 
-	p2p_dbg(p2p, "Starting Listen timeout(%u,%u) on freq=%u based on callback",
+	p2p_dbg(p2p, "Starting Listen timeout(%u,%u) on freq=%g based on callback",
 		p2p->pending_listen_sec, p2p->pending_listen_usec,
-		p2p->pending_listen_freq);
+		PR_KHZ(p2p->pending_listen_freq));
 	p2p->in_listen = 1;
 	p2p->drv_in_listen = freq;
 	if (p2p->pending_listen_sec || p2p->pending_listen_usec) {
@@ -3838,7 +3840,7 @@ void p2p_listen_cb(struct p2p_data *p2p, unsigned int freq,
 
 int p2p_listen_end(struct p2p_data *p2p, unsigned int freq)
 {
-	p2p_dbg(p2p, "Driver ended Listen state (freq=%u)", freq);
+	p2p_dbg(p2p, "Driver ended Listen state (freq=%g)", PR_KHZ(freq));
 	p2p->drv_in_listen = 0;
 	if (p2p->in_listen)
 		return 0; /* Internal timeout will trigger the next step */
@@ -4257,7 +4259,7 @@ int p2p_get_peer_info_txt(const struct p2p_peer_info *info,
 	os_get_reltime(&now);
 	res = os_snprintf(pos, end - pos,
 			  "age=%d\n"
-			  "listen_freq=%d\n"
+			  "listen_freq=%g\n"
 			  "wps_method=%s\n"
 			  "interface_addr=" MACSTR "\n"
 			  "member_in_go_dev=" MACSTR "\n"
@@ -4267,13 +4269,13 @@ int p2p_get_peer_info_txt(const struct p2p_peer_info *info,
 			  "dialog_token=%u\n"
 			  "intended_addr=" MACSTR "\n"
 			  "country=%c%c\n"
-			  "oper_freq=%d\n"
+			  "oper_freq=%g\n"
 			  "req_config_methods=0x%x\n"
 			  "flags=%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n"
 			  "status=%d\n"
 			  "invitation_reqs=%u\n",
 			  (int) (now.sec - dev->last_seen.sec),
-			  dev->listen_freq,
+			  PR_KHZ(dev->listen_freq),
 			  p2p_wps_method_text(dev->wps_method),
 			  MAC2STR(dev->interface_addr),
 			  MAC2STR(dev->member_in_go_dev),
@@ -4284,7 +4286,7 @@ int p2p_get_peer_info_txt(const struct p2p_peer_info *info,
 			  MAC2STR(dev->intended_addr),
 			  dev->country[0] ? dev->country[0] : '_',
 			  dev->country[1] ? dev->country[1] : '_',
-			  dev->oper_freq,
+			  PR_KHZ(dev->oper_freq),
 			  dev->req_config_methods,
 			  dev->flags & P2P_DEV_PROBE_REQ_ONLY ?
 			  "[PROBE_REQ_ONLY]" : "",
@@ -4426,10 +4428,10 @@ int p2p_presence_req(struct p2p_data *p2p, const u8 *go_interface_addr,
 	struct wpabuf *req;
 
 	p2p_dbg(p2p, "Send Presence Request to GO " MACSTR
-		" (own interface " MACSTR ") freq=%u dur1=%u int1=%u "
+		" (own interface " MACSTR ") freq=%g dur1=%u int1=%u "
 		"dur2=%u int2=%u",
 		MAC2STR(go_interface_addr), MAC2STR(own_interface_addr),
-		freq, duration1, interval1, duration2, interval2);
+		PR_KHZ(freq), duration1, interval1, duration2, interval2);
 
 	req = p2p_build_presence_req(duration1, interval1, duration2,
 				     interval2);
diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h
index 2dae6c6ecdec..5417fad30482 100644
--- a/src/p2p/p2p.h
+++ b/src/p2p/p2p.h
@@ -91,7 +91,7 @@ struct p2p_go_neg_results {
 	int role_go;
 
 	/**
-	 * freq - Frequency of the group operational channel in MHz
+	 * freq - Frequency of the group operational channel in KHz
 	 */
 	int freq;
 
diff --git a/src/p2p/p2p_build.c b/src/p2p/p2p_build.c
index 63eb2e84c376..d52f989409ab 100644
--- a/src/p2p/p2p_build.c
+++ b/src/p2p/p2p_build.c
@@ -138,8 +138,8 @@ void p2p_buf_add_pref_channel_list(struct wpabuf *buf,
 	for (i = 0; i < size; i++) {
 		if (p2p_freq_to_channel(preferred_freq_list[i], &op_class,
 					&op_channel) < 0) {
-			wpa_printf(MSG_DEBUG, "Unsupported frequency %u MHz",
-				   preferred_freq_list[i]);
+			wpa_printf(MSG_DEBUG, "Unsupported frequency %g MHz",
+				   PR_KHZ(preferred_freq_list[i]));
 			continue;
 		}
 		wpabuf_put_u8(buf, op_class);
diff --git a/src/p2p/p2p_dev_disc.c b/src/p2p/p2p_dev_disc.c
index 98805fee2409..ba83aabee636 100644
--- a/src/p2p/p2p_dev_disc.c
+++ b/src/p2p/p2p_dev_disc.c
@@ -165,7 +165,7 @@ void p2p_process_dev_disc_req(struct p2p_data *p2p, const u8 *sa,
 	size_t g;
 
 	p2p_dbg(p2p, "Received Device Discoverability Request from " MACSTR
-		" (freq=%d)", MAC2STR(sa), rx_freq);
+		" (freq=%g)", MAC2STR(sa), PR_KHZ(rx_freq));
 
 	if (p2p_parse(data, len, &msg))
 		return;
diff --git a/src/p2p/p2p_go_neg.c b/src/p2p/p2p_go_neg.c
index 113346141986..a3a6067ea9da 100644
--- a/src/p2p/p2p_go_neg.c
+++ b/src/p2p/p2p_go_neg.c
@@ -416,7 +416,7 @@ void p2p_reselect_channel(struct p2p_data *p2p,
 
 	/* First, try to pick the best channel from another band */
 	freq = p2p_channel_to_freq(p2p->op_reg_class, p2p->op_channel);
-	if (freq >= 2400 && freq < 2500 && p2p->best_freq_5 > 0 &&
+	if (freq >= KHZ(2400) && freq < KHZ(2500) && p2p->best_freq_5 > 0 &&
 	    !p2p_channels_includes(intersection, p2p->op_reg_class,
 				   p2p->op_channel) &&
 	    p2p_freq_to_channel(p2p->best_freq_5,
@@ -429,7 +429,7 @@ void p2p_reselect_channel(struct p2p_data *p2p,
 		return;
 	}
 
-	if (freq >= 4900 && freq < 6000 && p2p->best_freq_24 > 0 &&
+	if (freq >= KHZ(4900) && freq < KHZ(6000) && p2p->best_freq_24 > 0 &&
 	    !p2p_channels_includes(intersection, p2p->op_reg_class,
 				   p2p->op_channel) &&
 	    p2p_freq_to_channel(p2p->best_freq_24,
@@ -751,8 +751,8 @@ void p2p_process_go_neg_req(struct p2p_data *p2p, const u8 *sa,
 	int tie_breaker = 0;
 	int freq;
 
-	p2p_dbg(p2p, "Received GO Negotiation Request from " MACSTR "(freq=%d)",
-		MAC2STR(sa), rx_freq);
+	p2p_dbg(p2p, "Received GO Negotiation Request from " MACSTR "(freq=%g)",
+		MAC2STR(sa), PR_KHZ(rx_freq));
 
 	if (p2p_parse(data, len, &msg))
 		return;
@@ -1157,7 +1157,7 @@ void p2p_process_go_neg_resp(struct p2p_data *p2p, const u8 *sa,
 	int freq;
 
 	p2p_dbg(p2p, "Received GO Negotiation Response from " MACSTR
-		" (freq=%d)", MAC2STR(sa), rx_freq);
+		" (freq=%g)", MAC2STR(sa), PR_KHZ(rx_freq));
 	dev = p2p_get_device(p2p, sa);
 	if (dev == NULL || dev->wps_method == WPS_NOT_READY ||
 	    dev != p2p->go_neg_peer) {
diff --git a/src/p2p/p2p_invitation.c b/src/p2p/p2p_invitation.c
index 77d662a47ae2..57240ffe8d8a 100644
--- a/src/p2p/p2p_invitation.c
+++ b/src/p2p/p2p_invitation.c
@@ -188,8 +188,8 @@ void p2p_process_invitation_req(struct p2p_data *p2p, const u8 *sa,
 
 	os_memset(group_bssid, 0, sizeof(group_bssid));
 
-	p2p_dbg(p2p, "Received Invitation Request from " MACSTR " (freq=%d)",
-		MAC2STR(sa), rx_freq);
+	p2p_dbg(p2p, "Received Invitation Request from " MACSTR " (freq=%g)",
+		MAC2STR(sa), PR_KHZ(rx_freq));
 
 	if (p2p_parse(data, len, &msg))
 		return;
@@ -653,8 +653,8 @@ int p2p_invite(struct p2p_data *p2p, const u8 *peer, enum p2p_invite_role role,
 	struct p2p_device *dev;
 
 	p2p_dbg(p2p, "Request to invite peer " MACSTR " role=%d persistent=%d "
-		"force_freq=%u",
-		MAC2STR(peer), role, persistent_group, force_freq);
+		"force_freq=%g",
+		MAC2STR(peer), role, persistent_group, PR_KHZ(force_freq));
 	if (bssid)
 		p2p_dbg(p2p, "Invitation for BSSID " MACSTR, MAC2STR(bssid));
 	if (go_dev_addr) {
diff --git a/src/p2p/p2p_pd.c b/src/p2p/p2p_pd.c
index 3994ec03f86b..bf65b7809d61 100644
--- a/src/p2p/p2p_pd.c
+++ b/src/p2p/p2p_pd.c
@@ -579,8 +579,8 @@ void p2p_process_prov_disc_req(struct p2p_data *p2p, const u8 *sa,
 		return;
 
 	p2p_dbg(p2p, "Received Provision Discovery Request from " MACSTR
-		" with config methods 0x%x (freq=%d)",
-		MAC2STR(sa), msg.wps_config_methods, rx_freq);
+		" with config methods 0x%x (freq=%g)",
+		MAC2STR(sa), msg.wps_config_methods, PR_KHZ(rx_freq));
 	group_mac = msg.intended_addr;
 
 	dev = p2p_get_device(p2p, sa);
diff --git a/src/p2p/p2p_sd.c b/src/p2p/p2p_sd.c
index b9e753f20516..6b9cbc560d62 100644
--- a/src/p2p/p2p_sd.c
+++ b/src/p2p/p2p_sd.c
@@ -432,7 +432,7 @@ void p2p_sd_response(struct p2p_data *p2p, int freq, const u8 *dst,
 	 * In the 60 GHz, we have a smaller maximum frame length for management
 	 * frames.
 	 */
-	max_len = (freq > 56160) ? 928 : 1400;
+	max_len = (freq > KHZ(56160)) ? 928 : 1400;
 
 	/* TODO: fix the length limit to match with the maximum frame length */
 	if (wpabuf_len(resp_tlvs) > max_len) {
@@ -652,7 +652,7 @@ void p2p_rx_gas_comeback_req(struct p2p_data *p2p, const u8 *sa,
 	 * In the 60 GHz, we have a smaller maximum frame length for management
 	 * frames.
 	 */
-	max_len = (rx_freq > 56160) ? 928 : 1400;
+	max_len = (rx_freq > KHZ(56160)) ? 928 : 1400;
 	frag_len = wpabuf_len(p2p->sd_resp) - p2p->sd_resp_pos;
 	if (frag_len > max_len) {
 		frag_len = max_len;
diff --git a/src/p2p/p2p_utils.c b/src/p2p/p2p_utils.c
index 1a62a44a2df3..3ceaf43c410f 100644
--- a/src/p2p/p2p_utils.c
+++ b/src/p2p/p2p_utils.c
@@ -68,8 +68,8 @@ int p2p_channel_to_freq(int op_class, int channel)
  */
 int p2p_freq_to_channel(unsigned int freq, u8 *op_class, u8 *channel)
 {
-	if (ieee80211_freq_to_channel_ext(freq, 0, 0, op_class, channel) ==
-	    NUM_HOSTAPD_MODES)
+	if (ieee80211_freq_to_channel_ext(freq, 0, 0, op_class,
+					  channel) == NUM_HOSTAPD_MODES)
 		return -1;
 
 	return 0;
@@ -427,16 +427,16 @@ int p2p_channel_random_social(struct p2p_channels *chans, u8 *op_class,
 	 * here for social channel selection unless explicitly disallowed in the
 	 * disallow_list. */
 	if (p2p_channels_includes(chans, 81, 1) ||
-	    (freq_range_list_includes(avoid_list, 2412) &&
-	     !freq_range_list_includes(disallow_list, 2412)))
+	    (freq_range_list_includes(avoid_list, KHZ(2412)) &&
+	     !freq_range_list_includes(disallow_list, KHZ(2412))))
 		chan[num_channels++] = 1;
 	if (p2p_channels_includes(chans, 81, 6) ||
-	    (freq_range_list_includes(avoid_list, 2437) &&
-	     !freq_range_list_includes(disallow_list, 2437)))
+	    (freq_range_list_includes(avoid_list, KHZ(2437)) &&
+	     !freq_range_list_includes(disallow_list, KHZ(2437))))
 		chan[num_channels++] = 6;
 	if (p2p_channels_includes(chans, 81, 11) ||
-	    (freq_range_list_includes(avoid_list, 2462) &&
-	     !freq_range_list_includes(disallow_list, 2462)))
+	    (freq_range_list_includes(avoid_list, KHZ(2462)) &&
+	     !freq_range_list_includes(disallow_list, KHZ(2462))))
 		chan[num_channels++] = 11;
 
 	/* Try to find available social channels from 60 GHz */
diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c
index 63171021f7f2..3f451af503af 100644
--- a/src/rsn_supp/wpa.c
+++ b/src/rsn_supp/wpa.c
@@ -760,8 +760,9 @@ static void wpa_supplicant_process_1_of_4(struct wpa_sm *sm,
 #ifdef CONFIG_TESTING_OPTIONS
 		if (sm->oci_freq_override_eapol) {
 			wpa_printf(MSG_INFO,
-				   "TEST: Override OCI KDE frequency %d -> %d MHz",
-				   ci.frequency, sm->oci_freq_override_eapol);
+				   "TEST: Override OCI KDE frequency %g -> %g MHz",
+				   PR_KHZ(ci.frequency),
+				   PR_KHZ(sm->oci_freq_override_eapol));
 			ci.frequency = sm->oci_freq_override_eapol;
 		}
 #endif /* CONFIG_TESTING_OPTIONS */
diff --git a/src/utils/common.c b/src/utils/common.c
index 2c12751938e5..3ce139ef66f1 100644
--- a/src/utils/common.c
+++ b/src/utils/common.c
@@ -778,8 +778,8 @@ char * dup_binstr(const void *src, size_t len)
 	return res;
 }
 
-
-int freq_range_list_parse(struct wpa_freq_range_list *res, const char *value)
+static int __int_range_list_parse(struct wpa_freq_range_list *res,
+				  const char *value, int is_freq)
 {
 	struct wpa_freq_range *freq = NULL, *n;
 	unsigned int count = 0;
@@ -802,12 +802,13 @@ int freq_range_list_parse(struct wpa_freq_range_list *res, const char *value)
 			return -1;
 		}
 		freq = n;
-		freq[count].min = atoi(pos);
+		freq[count].min = is_freq ? KHZ(atof(pos)) : atoi(pos);
 		pos2 = os_strchr(pos, '-');
 		pos3 = os_strchr(pos, ',');
 		if (pos2 && (!pos3 || pos2 < pos3)) {
 			pos2++;
-			freq[count].max = atoi(pos2);
+			freq[count].max = is_freq ? KHZ(atof(pos2)) :
+						    atoi(pos2);
 		} else
 			freq[count].max = freq[count].min;
 		pos = pos3;
@@ -823,6 +824,16 @@ int freq_range_list_parse(struct wpa_freq_range_list *res, const char *value)
 	return 0;
 }
 
+int int_range_list_parse(struct wpa_freq_range_list *res, const char *value)
+{
+	return __int_range_list_parse(res, value, 0);
+}
+
+int freq_range_list_parse(struct wpa_freq_range_list *res, const char *value)
+{
+	return __int_range_list_parse(res, value, 1);
+}
+
 
 int freq_range_list_includes(const struct wpa_freq_range_list *list,
 			     unsigned int freq)
@@ -862,12 +873,14 @@ char * freq_range_list_str(const struct wpa_freq_range_list *list)
 		struct wpa_freq_range *range = &list->range[i];
 
 		if (range->min == range->max)
-			res = os_snprintf(pos, end - pos, "%s%u",
-					  i == 0 ? "" : ",", range->min);
+			res = os_snprintf(pos, end - pos, "%s%g",
+					  i == 0 ? "" : ",",
+					  PR_KHZ(range->min));
 		else
-			res = os_snprintf(pos, end - pos, "%s%u-%u",
+			res = os_snprintf(pos, end - pos, "%s%g-%g",
 					  i == 0 ? "" : ",",
-					  range->min, range->max);
+					  PR_KHZ(range->min),
+					  PR_KHZ(range->max));
 		if (os_snprintf_error(end - pos, res)) {
 			os_free(buf);
 			return NULL;
diff --git a/src/utils/common.h b/src/utils/common.h
index 45f72bb30984..db42012ff510 100644
--- a/src/utils/common.h
+++ b/src/utils/common.h
@@ -543,6 +543,7 @@ struct wpa_freq_range_list {
 	unsigned int num;
 };
 
+int int_range_list_parse(struct wpa_freq_range_list *res, const char *value);
 int freq_range_list_parse(struct wpa_freq_range_list *res, const char *value);
 int freq_range_list_includes(const struct wpa_freq_range_list *list,
 			     unsigned int freq);
diff --git a/tests/ap-mgmt-fuzzer/ap-mgmt-fuzzer.c b/tests/ap-mgmt-fuzzer/ap-mgmt-fuzzer.c
index 9d61b6bcc76d..30a1ae961233 100644
--- a/tests/ap-mgmt-fuzzer/ap-mgmt-fuzzer.c
+++ b/tests/ap-mgmt-fuzzer/ap-mgmt-fuzzer.c
@@ -94,7 +94,7 @@ static struct hostapd_hw_modes * gen_modes(void)
 		return NULL;
 	}
 	chan->chan = 1;
-	chan->freq = 2412;
+	chan->freq = KHZ(2412);
 	mode->channels = chan;
 	mode->num_channels = 1;
 
diff --git a/tests/hwsim/test_wpas_ctrl.py b/tests/hwsim/test_wpas_ctrl.py
index 04418f09367f..a1b67937aa15 100644
--- a/tests/hwsim/test_wpas_ctrl.py
+++ b/tests/hwsim/test_wpas_ctrl.py
@@ -1674,13 +1674,13 @@ def test_wpas_ctrl_oom(dev):
 def _test_wpas_ctrl_oom(dev):
     dev[0].request('VENDOR_ELEM_ADD 2 000100')
     tests = [('DRIVER_EVENT AVOID_FREQUENCIES 2412', 'FAIL',
-              1, 'freq_range_list_parse'),
+              1, '__int_range_list_parse'),
              ('P2P_SET disallow_freq 2412', 'FAIL',
-              1, 'freq_range_list_parse'),
+              1, '__int_range_list_parse'),
              ('SCAN freq=2412', 'FAIL',
-              1, 'freq_range_list_parse'),
+              1, '__int_range_list_parse'),
              ('INTERWORKING_SELECT freq=2412', 'FAIL',
-              1, 'freq_range_list_parse'),
+              1, '__int_range_list_parse'),
              ('SCAN ssid 112233', 'FAIL',
               1, 'wpas_ctrl_scan'),
              ('MGMT_TX 00:00:00:00:00:00 00:00:00:00:00:00 action=00', 'FAIL',
diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index 2accf92cd413..60f829f96d14 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -139,8 +139,8 @@ int wpa_supplicant_conf_ap_ht(struct wpa_supplicant *wpa_s,
 					       &conf->channel);
 
 	if (conf->hw_mode == NUM_HOSTAPD_MODES) {
-		wpa_printf(MSG_ERROR, "Unsupported AP mode frequency: %d MHz",
-			   ssid->frequency);
+		wpa_printf(MSG_ERROR, "Unsupported AP mode frequency: %g MHz",
+			   PR_KHZ(ssid->frequency));
 		return -1;
 	}
 
@@ -158,8 +158,8 @@ int wpa_supplicant_conf_ap_ht(struct wpa_supplicant *wpa_s,
 		int i, no_ht = 0;
 
 		wpa_printf(MSG_DEBUG,
-			   "Determining HT/VHT options based on driver capabilities (freq=%u chan=%u)",
-			   ssid->frequency, conf->channel);
+			   "Determining HT/VHT options based on driver capabilities (freq=%g chan=%u)",
+			   PR_KHZ(ssid->frequency), conf->channel);
 
 		for (i = 0; i < wpa_s->hw.num_modes; i++) {
 			if (wpa_s->hw.modes[i].mode == conf->hw_mode) {
@@ -776,7 +776,7 @@ int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
 		return -1;
 	}
 	if (ssid->frequency == 0)
-		ssid->frequency = 2462; /* default channel 11 */
+		ssid->frequency = KHZ(2462); /* default channel 11 */
 	params.freq.freq = ssid->frequency;
 
 	if ((ssid->mode == WPAS_MODE_AP || ssid->mode == WPAS_MODE_P2P_GO) &&
@@ -1657,7 +1657,8 @@ void wpas_ap_event_dfs_radar_detected(struct wpa_supplicant *wpa_s,
 		iface = wpa_s->ifmsh;
 	if (!iface || !iface->bss[0])
 		return;
-	wpa_printf(MSG_DEBUG, "DFS radar detected on %d MHz", radar->freq);
+	wpa_printf(MSG_DEBUG, "DFS radar detected on %g MHz",
+		   PR_KHZ(radar->freq));
 	hostapd_dfs_radar_detected(iface, radar->freq,
 				   radar->ht_enabled, radar->chan_offset,
 				   radar->chan_width,
@@ -1674,7 +1675,7 @@ void wpas_ap_event_dfs_cac_started(struct wpa_supplicant *wpa_s,
 		iface = wpa_s->ifmsh;
 	if (!iface || !iface->bss[0])
 		return;
-	wpa_printf(MSG_DEBUG, "DFS CAC started on %d MHz", radar->freq);
+	wpa_printf(MSG_DEBUG, "DFS CAC started on %g MHz", PR_KHZ(radar->freq));
 	hostapd_dfs_start_cac(iface, radar->freq,
 			      radar->ht_enabled, radar->chan_offset,
 			      radar->chan_width, radar->cf1, radar->cf2);
@@ -1690,7 +1691,8 @@ void wpas_ap_event_dfs_cac_finished(struct wpa_supplicant *wpa_s,
 		iface = wpa_s->ifmsh;
 	if (!iface || !iface->bss[0])
 		return;
-	wpa_printf(MSG_DEBUG, "DFS CAC finished on %d MHz", radar->freq);
+	wpa_printf(MSG_DEBUG, "DFS CAC finished on %g MHz",
+		   PR_KHZ(radar->freq));
 	hostapd_dfs_complete_cac(iface, 1, radar->freq,
 				 radar->ht_enabled, radar->chan_offset,
 				 radar->chan_width, radar->cf1, radar->cf2);
@@ -1706,7 +1708,7 @@ void wpas_ap_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s,
 		iface = wpa_s->ifmsh;
 	if (!iface || !iface->bss[0])
 		return;
-	wpa_printf(MSG_DEBUG, "DFS CAC aborted on %d MHz", radar->freq);
+	wpa_printf(MSG_DEBUG, "DFS CAC aborted on %g MHz", PR_KHZ(radar->freq));
 	hostapd_dfs_complete_cac(iface, 0, radar->freq,
 				 radar->ht_enabled, radar->chan_offset,
 				 radar->chan_width, radar->cf1, radar->cf2);
@@ -1722,7 +1724,8 @@ void wpas_ap_event_dfs_cac_nop_finished(struct wpa_supplicant *wpa_s,
 		iface = wpa_s->ifmsh;
 	if (!iface || !iface->bss[0])
 		return;
-	wpa_printf(MSG_DEBUG, "DFS NOP finished on %d MHz", radar->freq);
+	wpa_printf(MSG_DEBUG, "DFS NOP finished on %g MHz",
+		   PR_KHZ(radar->freq));
 	hostapd_dfs_nop_finished(iface, radar->freq,
 				 radar->ht_enabled, radar->chan_offset,
 				 radar->chan_width, radar->cf1, radar->cf2);
diff --git a/wpa_supplicant/bgscan_learn.c b/wpa_supplicant/bgscan_learn.c
index cb732f709b9e..b55e0f79b2b4 100644
--- a/wpa_supplicant/bgscan_learn.c
+++ b/wpa_supplicant/bgscan_learn.c
@@ -131,11 +131,11 @@ static int bgscan_learn_load(struct bgscan_learn_data *data)
 				bss_free(bss);
 				continue;
 			}
-			bss->freq = atoi(buf + 4 + 18);
+			bss->freq = KHZ(atoi(buf + 4 + 18));
 			dl_list_add(&data->bss, &bss->list);
 			wpa_printf(MSG_DEBUG, "bgscan learn: Loaded BSS "
-				   "entry: " MACSTR " freq=%d",
-				   MAC2STR(bss->bssid), bss->freq);
+				   "entry: " MACSTR " freq=%g",
+				   MAC2STR(bss->bssid), PR_KHZ(bss->freq));
 		}
 
 		if (os_strncmp(buf, "NEIGHBOR ", 9) == 0) {
@@ -175,8 +175,8 @@ static void bgscan_learn_save(struct bgscan_learn_data *data)
 	fprintf(f, "wpa_supplicant-bgscan-learn\n");
 
 	dl_list_for_each(bss, &data->bss, struct bgscan_learn_bss, list) {
-		fprintf(f, "BSS " MACSTR " %d\n",
-			MAC2STR(bss->bssid), bss->freq);
+		fprintf(f, "BSS " MACSTR " %g\n",
+			MAC2STR(bss->bssid), PR_KHZ(bss->freq));
 	}
 
 	dl_list_for_each(bss, &data->bss, struct bgscan_learn_bss, list) {
@@ -517,12 +517,14 @@ static int bgscan_learn_notify_scan(void *priv,
 		bss = bgscan_learn_get_bss(data, res->bssid);
 		if (bss && bss->freq != res->freq) {
 			wpa_printf(MSG_DEBUG, "bgscan learn: Update BSS "
-			   MACSTR " freq %d -> %d",
-				   MAC2STR(res->bssid), bss->freq, res->freq);
+			   MACSTR " freq %g -> %g",
+				   MAC2STR(res->bssid), PR_KHZ(bss->freq),
+				   PR_KHZ(res->freq));
 			bss->freq = res->freq;
 		} else if (!bss) {
 			wpa_printf(MSG_DEBUG, "bgscan learn: Add BSS " MACSTR
-				   " freq=%d", MAC2STR(res->bssid), res->freq);
+				   " freq=%g", MAC2STR(res->bssid),
+				   PR_KHZ(res->freq));
 			bss = os_zalloc(sizeof(*bss));
 			if (!bss)
 				continue;
diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c
index 127f43e5e6b3..94560a827bc1 100644
--- a/wpa_supplicant/bss.c
+++ b/wpa_supplicant/bss.c
@@ -463,9 +463,9 @@ static struct wpa_bss * wpa_bss_add(struct wpa_supplicant *wpa_s,
 	else
 		extra[0] = '\0';
 	wpa_dbg(wpa_s, MSG_DEBUG, "BSS: Add new id %u BSSID " MACSTR
-		" SSID '%s' freq %d%s",
+		" SSID '%s' freq %g%s",
 		bss->id, MAC2STR(bss->bssid), wpa_ssid_txt(ssid, ssid_len),
-		bss->freq, extra);
+		PR_KHZ(bss->freq), extra);
 	wpas_notify_bss_added(wpa_s, bss->bssid, bss->id);
 	return bss;
 }
diff --git a/wpa_supplicant/bss.h b/wpa_supplicant/bss.h
index 0716761749f6..5debdd680182 100644
--- a/wpa_supplicant/bss.h
+++ b/wpa_supplicant/bss.h
@@ -83,7 +83,7 @@ struct wpa_bss {
 	u8 ssid[SSID_MAX_LEN];
 	/** Length of SSID */
 	size_t ssid_len;
-	/** Frequency of the channel in MHz (e.g., 2412 = channel 1) */
+	/** Frequency of the channel in KHz (e.g., 2412000 = channel 1) */
 	int freq;
 	/** Beacon interval in TUs (host byte order) */
 	u16 beacon_int;
@@ -153,7 +153,7 @@ int wpa_bss_ext_capab(const struct wpa_bss *bss, unsigned int capab);
 
 static inline int bss_is_dmg(const struct wpa_bss *bss)
 {
-	return bss->freq > 45000;
+	return MHZ(bss->freq) > 45000;
 }
 
 /**
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index 0b4a66ad7e64..4fab2d9de2cd 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -197,15 +197,15 @@ static char * wpa_config_write_str(const struct parse_data *data,
 #endif /* NO_CONFIG_WRITE */
 
 
-static int wpa_config_parse_int(const struct parse_data *data,
-				struct wpa_ssid *ssid,
-				int line, const char *value)
+static int __wpa_config_parse_int(const struct parse_data *data, struct wpa_ssid
+				  *ssid, int line, const char *value,
+				  int is_freq)
 {
 	int val, *dst;
 	char *end;
 
 	dst = (int *) (((u8 *) ssid) + (long) data->param1);
-	val = strtol(value, &end, 0);
+	val = is_freq ? KHZ(strtof(value, &end)) : strtol(value, &end, 0);
 	if (*end) {
 		wpa_printf(MSG_ERROR, "Line %d: invalid number \"%s\"",
 			   line, value);
@@ -225,7 +225,9 @@ static int wpa_config_parse_int(const struct parse_data *data,
 		return -1;
 	}
 
-	if (data->param4 && *dst > (long) data->param4) {
+	if (data->param4 &&
+	    ((!is_freq && *dst > (long) data->param4) ||
+	     (is_freq && MHZ(*dst) > (long) data->param4))) {
 		wpa_printf(MSG_ERROR, "Line %d: too large %s (value=%d "
 			   "max_value=%ld)", line, data->name, *dst,
 			   (long) data->param4);
@@ -236,10 +238,24 @@ static int wpa_config_parse_int(const struct parse_data *data,
 	return 0;
 }
 
+static int wpa_config_parse_int(const struct parse_data *data,
+				struct wpa_ssid *ssid,
+				int line, const char *value)
+{
+	return __wpa_config_parse_int(data, ssid, line, value, 0);
+}
+
+static int wpa_config_parse_freq(const struct parse_data *data,
+				 struct wpa_ssid *ssid,
+				 int line, const char *value)
+{
+	return __wpa_config_parse_int(data, ssid, line, value, 1);
+}
+
 
 #ifndef NO_CONFIG_WRITE
-static char * wpa_config_write_int(const struct parse_data *data,
-				   struct wpa_ssid *ssid)
+static char * __wpa_config_write_int(const struct parse_data *data,
+				     struct wpa_ssid *ssid, int is_freq)
 {
 	int *src, res;
 	char *value;
@@ -249,7 +265,10 @@ static char * wpa_config_write_int(const struct parse_data *data,
 	value = os_malloc(20);
 	if (value == NULL)
 		return NULL;
-	res = os_snprintf(value, 20, "%d", *src);
+	if (is_freq)
+		res = os_snprintf(value, 20, "%g", PR_KHZ(*src));
+	else
+		res = os_snprintf(value, 20, "%d", *src);
 	if (os_snprintf_error(20, res)) {
 		os_free(value);
 		return NULL;
@@ -257,6 +276,18 @@ static char * wpa_config_write_int(const struct parse_data *data,
 	value[20 - 1] = '\0';
 	return value;
 }
+
+static char * wpa_config_write_int(const struct parse_data *data,
+				   struct wpa_ssid *ssid)
+{
+	return __wpa_config_write_int(data, ssid, 0);
+}
+
+static char * wpa_config_write_freq(const struct parse_data *data,
+				    struct wpa_ssid *ssid)
+{
+	return __wpa_config_write_int(data, ssid, 1);
+}
 #endif /* NO_CONFIG_WRITE */
 
 
@@ -1325,7 +1356,7 @@ static char * wpa_config_write_auth_alg(const struct parse_data *data,
 #endif /* NO_CONFIG_WRITE */
 
 
-static int * wpa_config_parse_int_array(const char *value)
+static int * __wpa_config_parse_int_array(const char *value, int is_freq)
 {
 	int *freqs;
 	size_t used, len;
@@ -1355,7 +1386,7 @@ static int * wpa_config_parse_int_array(const char *value)
 			len *= 2;
 		}
 
-		freqs[used] = atoi(pos);
+		freqs[used] = is_freq ? KHZ(atof(pos)) : atoi(pos);
 		if (freqs[used] == 0)
 			break;
 		used++;
@@ -1365,6 +1396,15 @@ static int * wpa_config_parse_int_array(const char *value)
 	return freqs;
 }
 
+static int * wpa_config_parse_freq_array(const char *value)
+{
+	return __wpa_config_parse_int_array(value, 1);
+}
+
+static int * wpa_config_parse_int_array(const char *value)
+{
+	return __wpa_config_parse_int_array(value, 0);
+}
 
 static int wpa_config_parse_scan_freq(const struct parse_data *data,
 				      struct wpa_ssid *ssid, int line,
@@ -1372,13 +1412,14 @@ static int wpa_config_parse_scan_freq(const struct parse_data *data,
 {
 	int *freqs;
 
-	freqs = wpa_config_parse_int_array(value);
+	freqs = wpa_config_parse_freq_array(value);
 	if (freqs == NULL)
 		return -1;
 	if (freqs[0] == 0) {
 		os_free(freqs);
 		freqs = NULL;
 	}
+
 	os_free(ssid->scan_freq);
 	ssid->scan_freq = freqs;
 
@@ -1392,7 +1433,7 @@ static int wpa_config_parse_freq_list(const struct parse_data *data,
 {
 	int *freqs;
 
-	freqs = wpa_config_parse_int_array(value);
+	freqs = wpa_config_parse_freq_array(value);
 	if (freqs == NULL)
 		return -1;
 	if (freqs[0] == 0) {
@@ -1427,8 +1468,8 @@ static char * wpa_config_write_freqs(const struct parse_data *data,
 	end = buf + 10 * count + 1;
 
 	for (i = 0; freqs[i]; i++) {
-		ret = os_snprintf(pos, end - pos, "%s%u",
-				  i == 0 ? "" : " ", freqs[i]);
+		ret = os_snprintf(pos, end - pos, "%s%g",
+				  i == 0 ? "" : " ", PR_KHZ(freqs[i]));
 		if (os_snprintf_error(end - pos, ret)) {
 			end[-1] = '\0';
 			return buf;
@@ -2309,11 +2350,14 @@ static char * wpa_config_write_peerkey(const struct parse_data *data,
 #ifdef NO_CONFIG_WRITE
 #define _INT(f) #f, wpa_config_parse_int, OFFSET(f), (void *) 0
 #define _INTe(f, m) #f, wpa_config_parse_int, OFFSET(eap.m), (void *) 0
+#define _FREQ(f) #f, wpa_config_parse_freq, OFFSET(f), (void *) 0
 #else /* NO_CONFIG_WRITE */
 #define _INT(f) #f, wpa_config_parse_int, wpa_config_write_int, \
 	OFFSET(f), (void *) 0
 #define _INTe(f, m) #f, wpa_config_parse_int, wpa_config_write_int,	\
 	OFFSET(eap.m), (void *) 0
+#define _FREQ(f) #f, wpa_config_parse_freq, wpa_config_write_freq, \
+	OFFSET(f), (void *) 0
 #endif /* NO_CONFIG_WRITE */
 
 /* INT: Define an integer variable */
@@ -2323,6 +2367,10 @@ static char * wpa_config_write_peerkey(const struct parse_data *data,
 /* INT_RANGE: Define an integer variable with allowed value range */
 #define INT_RANGE(f, min, max) _INT(f), (void *) (min), (void *) (max), 0
 
+/* FREQ_RANGE: Define a frequency variable with allowed value range */
+#define FREQ_RANGE(f, min, max) _FREQ(f), (void *) (min), (void *) (max), 0
+#define FREQ(f) _FREQ(f), NULL, NULL, 0
+
 /* FUNC: Define a configuration variable that uses a custom function for
  * parsing and writing the value. */
 #ifdef NO_CONFIG_WRITE
@@ -2382,8 +2430,8 @@ static const struct parse_data ssid_fields[] = {
 	{ INT_RANGE(ht40, -1, 1) },
 	{ INT_RANGE(max_oper_chwidth, CHANWIDTH_USE_HT,
 		    CHANWIDTH_80P80MHZ) },
-	{ INT(vht_center_freq1) },
-	{ INT(vht_center_freq2) },
+	{ FREQ(vht_center_freq1) },
+	{ FREQ(vht_center_freq2) },
 #ifdef IEEE8021X_EAPOL
 	{ FUNC(eap) },
 	{ STR_LENe(identity, identity) },
@@ -2486,7 +2534,7 @@ static const struct parse_data ssid_fields[] = {
 #endif /* CONFIG_OCV */
 	{ FUNC(peerkey) /* obsolete - removed */ },
 	{ INT_RANGE(mixed_cell, 0, 1) },
-	{ INT_RANGE(frequency, 0, 70200) },
+	{ FREQ_RANGE(frequency, 0, 70200) },
 	{ INT_RANGE(fixed_freq, 0, 1) },
 	{ INT_RANGE(enable_edmg, 0, 1) },
 	{ INT_RANGE(edmg_channel, 9, 13) },
@@ -4496,7 +4544,7 @@ static int wpa_config_process_freq_list(const struct global_parse_data *data,
 {
 	int *freqs;
 
-	freqs = wpa_config_parse_int_array(value);
+	freqs = wpa_config_parse_freq_array(value);
 	if (freqs == NULL)
 		return -1;
 	if (freqs[0] == 0) {
diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c
index 1ca254813f78..37d71f178893 100644
--- a/wpa_supplicant/config_file.c
+++ b/wpa_supplicant/config_file.c
@@ -518,6 +518,13 @@ static void write_int(FILE *f, const char *field, int value, int def)
 	fprintf(f, "\t%s=%d\n", field, value);
 }
 
+static void write_freq(FILE *f, const char *field, int value, int def)
+{
+	if (value == def)
+		return;
+	fprintf(f, "\t%s=%g\n", field, PR_KHZ(value));
+}
+
 
 static void write_bssid(FILE *f, struct wpa_ssid *ssid)
 {
@@ -762,6 +769,7 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid)
 #define INTe(t, m) write_int(f, #t, ssid->eap.m, 0)
 #define INT_DEF(t, def) write_int(f, #t, ssid->t, def)
 #define INT_DEFe(t, m, def) write_int(f, #t, ssid->eap.m, def)
+#define FREQ(t) write_freq(f, #t, ssid->t, 0)
 
 	STR(ssid);
 	INT(scan_ssid);
@@ -866,7 +874,7 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid)
 #endif /* IEEE8021X_EAPOL */
 	INT(mode);
 	INT(no_auto_peer);
-	INT(frequency);
+	FREQ(frequency);
 	INT(enable_edmg);
 	INT(edmg_channel);
 	INT(fixed_freq);
@@ -880,8 +888,8 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid)
 	INT_DEF(ht, 1);
 	INT(ht40);
 	INT_DEF(max_oper_chwidth, DEFAULT_MAX_OPER_CHWIDTH);
-	INT(vht_center_freq1);
-	INT(vht_center_freq2);
+	FREQ(vht_center_freq1);
+	FREQ(vht_center_freq2);
 	INT(pbss);
 	INT(wps_disabled);
 	INT(fils_dh_group);
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 8d2ccbae5366..c711269dfad1 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -752,11 +752,11 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s,
 	} else if (os_strcasecmp(cmd, "ft_rsnxe_used") == 0) {
 		wpa_s->ft_rsnxe_used = atoi(value);
 	} else if (os_strcasecmp(cmd, "oci_freq_override_eapol") == 0) {
-		wpa_s->oci_freq_override_eapol = atoi(value);
+		wpa_s->oci_freq_override_eapol = KHZ(atof(value));
 	} else if (os_strcasecmp(cmd, "oci_freq_override_saquery_req") == 0) {
-		wpa_s->oci_freq_override_saquery_req = atoi(value);
+		wpa_s->oci_freq_override_saquery_req = KHZ(atof(value));
 	} else if (os_strcasecmp(cmd, "oci_freq_override_saquery_resp") == 0) {
-		wpa_s->oci_freq_override_saquery_resp = atoi(value);
+		wpa_s->oci_freq_override_saquery_resp = KHZ(atof(value));
 	} else if (os_strcasecmp(cmd, "rsne_override_eapol") == 0) {
 		wpabuf_free(wpa_s->rsne_override_eapol);
 		if (os_strcmp(value, "NULL") == 0)
@@ -1105,7 +1105,7 @@ static int wpa_supplicant_ctrl_iface_tdls_chan_switch(
 	}
 
 	pos = end;
-	freq_params.freq = atoi(pos);
+	freq_params.freq = KHZ(atof(pos));
 	if (freq_params.freq == 0) {
 		wpa_printf(MSG_INFO, "tdls_chanswitch: Invalid freq provided");
 		return -1;
@@ -1122,6 +1122,9 @@ static int wpa_supplicant_ctrl_iface_tdls_chan_switch(
 
 	SET_FREQ_SETTING(center_freq1);
 	SET_FREQ_SETTING(center_freq2);
+	/* TODO: fix */
+	freq_params.center_freq1 = KHZ(freq_params.center_freq1);
+	freq_params.center_freq2 = KHZ(freq_params.center_freq2);
 	SET_FREQ_SETTING(bandwidth);
 	SET_FREQ_SETTING(sec_channel_offset);
 #undef SET_FREQ_SETTING
@@ -1137,9 +1140,10 @@ static int wpa_supplicant_ctrl_iface_tdls_chan_switch(
 	}
 
 	wpa_printf(MSG_DEBUG, "CTRL_IFACE TDLS_CHAN_SWITCH " MACSTR
-		   " OP CLASS %d FREQ %d CENTER1 %d CENTER2 %d BW %d SEC_OFFSET %d%s%s",
-		   MAC2STR(peer), oper_class, freq_params.freq,
-		   freq_params.center_freq1, freq_params.center_freq2,
+		   " OP CLASS %d FREQ %g CENTER1 %g CENTER2 %g BW %d SEC_OFFSET %d%s%s",
+		   MAC2STR(peer), oper_class, PR_KHZ(freq_params.freq),
+		   PR_KHZ(freq_params.center_freq1),
+		   PR_KHZ(freq_params.center_freq2),
 		   freq_params.bandwidth, freq_params.sec_channel_offset,
 		   freq_params.ht_enabled ? " HT" : "",
 		   freq_params.vht_enabled ? " VHT" : "");
@@ -1536,7 +1540,7 @@ static int wpa_supplicant_ctrl_iface_wps_nfc_tag_read(
 	if (freq) {
 		*freq = '\0';
 		freq += 6;
-		forced_freq = atoi(freq);
+		forced_freq = KHZ(atof(freq));
 	}
 
 	len = os_strlen(pos);
@@ -1751,7 +1755,7 @@ static int wpas_ctrl_nfc_report_handover(struct wpa_supplicant *wpa_s,
 	if (freq) {
 		*freq = '\0';
 		freq += 6;
-		forced_freq = atoi(freq);
+		forced_freq = KHZ(atof(freq));
 	}
 #endif /* CONFIG_P2P */
 
@@ -2176,8 +2180,8 @@ static int wpa_supplicant_ctrl_iface_status(struct wpa_supplicant *wpa_s,
 		if (os_snprintf_error(end - pos, ret))
 			return pos - buf;
 		pos += ret;
-		ret = os_snprintf(pos, end - pos, "freq=%u\n",
-				  wpa_s->assoc_freq);
+		ret = os_snprintf(pos, end - pos, "freq=%g\n",
+				  PR_KHZ(wpa_s->assoc_freq));
 		if (os_snprintf_error(end - pos, ret))
 			return pos - buf;
 		pos += ret;
@@ -2958,8 +2962,8 @@ static int wpa_supplicant_ctrl_iface_scan_result(
 	pos = buf;
 	end = buf + buflen;
 
-	ret = os_snprintf(pos, end - pos, MACSTR "\t%d\t%d\t",
-			  MAC2STR(bss->bssid), bss->freq, bss->level);
+	ret = os_snprintf(pos, end - pos, MACSTR "\t%g\t%d\t",
+			  MAC2STR(bss->bssid), PR_KHZ(bss->freq), bss->level);
 	if (os_snprintf_error(end - pos, ret))
 		return -1;
 	pos += ret;
@@ -4625,8 +4629,8 @@ static int ctrl_iface_get_capability_freq(struct wpa_supplicant *wpa_s,
 		for (i = 0; i < wpa_s->hw.modes[j].num_channels; i++) {
 			if (chnl[i].flag & HOSTAPD_CHAN_DISABLED)
 				continue;
-			ret = os_snprintf(pos, end - pos, " %d = %d MHz%s%s\n",
-					  chnl[i].chan, chnl[i].freq,
+			ret = os_snprintf(pos, end - pos, " %d = %g MHz%s%s\n",
+					  chnl[i].chan, PR_KHZ(chnl[i].freq),
 					  chnl[i].flag & HOSTAPD_CHAN_NO_IR ?
 					  " (NO_IR)" : "",
 					  chnl[i].flag & HOSTAPD_CHAN_RADAR ?
@@ -4951,7 +4955,7 @@ static int print_bss_info(struct wpa_supplicant *wpa_s, struct wpa_bss *bss,
 	}
 
 	if (mask & WPA_BSS_MASK_FREQ) {
-		ret = os_snprintf(pos, end - pos, "freq=%d\n", bss->freq);
+		ret = os_snprintf(pos, end - pos, "freq=%g\n", PR_KHZ(bss->freq));
 		if (os_snprintf_error(end - pos, ret))
 			return 0;
 		pos += ret;
@@ -5683,7 +5687,7 @@ static int p2p_ctrl_find(struct wpa_supplicant *wpa_s, char *cmd)
 	pos = os_strstr(cmd, "freq=");
 	if (pos) {
 		pos += 5;
-		freq = atoi(pos);
+		freq = KHZ(atof(pos));
 		if (freq <= 0)
 			return -1;
 	}
@@ -6021,14 +6025,14 @@ static int p2p_ctrl_connect(struct wpa_supplicant *wpa_s, char *cmd,
 	pos2 = os_strstr(pos, " freq=");
 	if (pos2) {
 		pos2 += 6;
-		freq = atoi(pos2);
+		freq = KHZ(atof(pos2));
 		if (freq <= 0)
 			return -1;
 	}
 
 	pos2 = os_strstr(pos, " freq2=");
 	if (pos2)
-		freq2 = atoi(pos2 + 7);
+		freq2 = KHZ(atof(pos2 + 7));
 
 	pos2 = os_strstr(pos, " max_oper_chwidth=");
 	if (pos2)
@@ -6657,7 +6661,7 @@ static int p2p_ctrl_invite_persistent(struct wpa_supplicant *wpa_s, char *cmd)
 	pos = os_strstr(cmd, " freq=");
 	if (pos) {
 		pos += 6;
-		freq = atoi(pos);
+		freq = KHZ(atof(pos));
 		if (freq <= 0)
 			return -1;
 	}
@@ -6665,7 +6669,7 @@ static int p2p_ctrl_invite_persistent(struct wpa_supplicant *wpa_s, char *cmd)
 	pos = os_strstr(cmd, " pref=");
 	if (pos) {
 		pos += 6;
-		pref_freq = atoi(pos);
+		pref_freq = KHZ(atof(pos));
 		if (pref_freq <= 0)
 			return -1;
 	}
@@ -6678,7 +6682,7 @@ static int p2p_ctrl_invite_persistent(struct wpa_supplicant *wpa_s, char *cmd)
 
 	pos = os_strstr(cmd, "freq2=");
 	if (pos)
-		freq2 = atoi(pos + 6);
+		freq2 = KHZ(atof(pos + 6));
 
 	pos = os_strstr(cmd, " max_oper_chwidth=");
 	if (pos)
@@ -6759,19 +6763,20 @@ static int p2p_ctrl_group_add_persistent(struct wpa_supplicant *wpa_s,
 
 static int p2p_ctrl_group_add(struct wpa_supplicant *wpa_s, char *cmd)
 {
-	int freq = 0, persistent = 0, group_id = -1;
+	float freq = 0, freq2 = 0;
+	int persistent = 0, group_id = -1;
 	int vht = wpa_s->conf->p2p_go_vht;
 	int ht40 = wpa_s->conf->p2p_go_ht40 || vht;
 	int he = wpa_s->conf->p2p_go_he;
 	int edmg = wpa_s->conf->p2p_go_edmg;
-	int max_oper_chwidth, chwidth = 0, freq2 = 0;
+	int max_oper_chwidth, chwidth = 0;
 	char *token, *context = NULL;
 #ifdef CONFIG_ACS
 	int acs = 0;
 #endif /* CONFIG_ACS */
 
 	while ((token = str_token(cmd, " ", &context))) {
-		if (sscanf(token, "freq2=%d", &freq2) == 1 ||
+		if (sscanf(token, "freq2=%f", &freq2) == 1 ||
 		    sscanf(token, "persistent=%d", &group_id) == 1 ||
 		    sscanf(token, "max_oper_chwidth=%d", &chwidth) == 1) {
 			continue;
@@ -6779,7 +6784,7 @@ static int p2p_ctrl_group_add(struct wpa_supplicant *wpa_s, char *cmd)
 		} else if (os_strcmp(token, "freq=acs") == 0) {
 			acs = 1;
 #endif /* CONFIG_ACS */
-		} else if (sscanf(token, "freq=%d", &freq) == 1) {
+		} else if (sscanf(token, "freq=%f", &freq) == 1) {
 			continue;
 		} else if (os_strcmp(token, "ht40") == 0) {
 			ht40 = 1;
@@ -6820,6 +6825,10 @@ static int p2p_ctrl_group_add(struct wpa_supplicant *wpa_s, char *cmd)
 	}
 #endif /* CONFIG_ACS */
 
+	freq2 = KHZ(freq2);
+	if (freq != 2 && freq != 5)
+		freq = KHZ(freq);
+
 	max_oper_chwidth = parse_freq(chwidth, freq2);
 	if (max_oper_chwidth < 0)
 		return -1;
@@ -7004,8 +7013,8 @@ static int p2p_ctrl_disallow_freq(struct wpa_supplicant *wpa_s,
 	for (i = 0; i < wpa_s->global->p2p_disallow_freq.num; i++) {
 		struct wpa_freq_range *freq;
 		freq = &wpa_s->global->p2p_disallow_freq.range[i];
-		wpa_printf(MSG_DEBUG, "P2P: Disallowed frequency range %u-%u",
-			   freq->min, freq->max);
+		wpa_printf(MSG_DEBUG, "P2P: Disallowed frequency range %g-%g",
+			   PR_KHZ(freq->min), PR_KHZ(freq->max));
 	}
 
 	wpas_p2p_update_channel_list(wpa_s, WPAS_P2P_CHANNEL_UPDATE_DISALLOW);
@@ -7329,15 +7338,17 @@ static int p2p_ctrl_remove_client(struct wpa_supplicant *wpa_s, const char *cmd)
 
 static int p2p_ctrl_iface_p2p_lo_start(struct wpa_supplicant *wpa_s, char *cmd)
 {
-	int freq = 0, period = 0, interval = 0, count = 0;
+	float freq = 0;
+	int period = 0, interval = 0, count = 0;
 
-	if (sscanf(cmd, "%d %d %d %d", &freq, &period, &interval, &count) != 4)
+	if (sscanf(cmd, "%f %d %d %d", &freq, &period, &interval, &count) != 4)
 	{
 		wpa_printf(MSG_DEBUG,
 			   "CTRL: Invalid P2P LO Start parameter: '%s'", cmd);
 		return -1;
 	}
 
+	freq = KHZ(freq);
 	return wpas_p2p_lo_start(wpa_s, freq, period, interval, count);
 }
 
@@ -7958,9 +7969,9 @@ static int wpa_supplicant_signal_poll(struct wpa_supplicant *wpa_s, char *buf,
 	end = buf + buflen;
 
 	ret = os_snprintf(pos, end - pos, "RSSI=%d\nLINKSPEED=%d\n"
-			  "NOISE=%d\nFREQUENCY=%u\n",
+			  "NOISE=%d\nFREQUENCY=%g\n",
 			  si.current_signal, si.current_txrate / 1000,
-			  si.current_noise, si.frequency);
+			  si.current_noise, PR_KHZ(si.frequency));
 	if (os_snprintf_error(end - pos, ret))
 		return -1;
 	pos += ret;
@@ -7974,16 +7985,16 @@ static int wpa_supplicant_signal_poll(struct wpa_supplicant *wpa_s, char *buf,
 	}
 
 	if (si.center_frq1 > 0) {
-		ret = os_snprintf(pos, end - pos, "CENTER_FRQ1=%d\n",
-				  si.center_frq1);
+		ret = os_snprintf(pos, end - pos, "CENTER_FRQ1=%g\n",
+				  PR_KHZ(si.center_frq1));
 		if (os_snprintf_error(end - pos, ret))
 			return -1;
 		pos += ret;
 	}
 
 	if (si.center_frq2 > 0) {
-		ret = os_snprintf(pos, end - pos, "CENTER_FRQ2=%d\n",
-				  si.center_frq2);
+		ret = os_snprintf(pos, end - pos, "CENTER_FRQ2=%g\n",
+				  PR_KHZ(si.center_frq2));
 		if (os_snprintf_error(end - pos, ret))
 			return -1;
 		pos += ret;
@@ -8059,7 +8070,7 @@ int wpas_ctrl_iface_get_pref_freq_list_override(struct wpa_supplicant *wpa_s,
 	pos++;
 	end = os_strchr(pos, ' ');
 	while (pos && (!end || pos < end) && count < *num) {
-		freq_list[count++] = atoi(pos);
+		freq_list[count++] = KHZ(atof(pos));
 		pos = os_strchr(pos, ',');
 		if (pos)
 			pos++;
@@ -8107,8 +8118,8 @@ static int wpas_ctrl_iface_get_pref_freq_list(
 		return -1;
 
 	for (i = 0; i < num; i++) {
-		ret = os_snprintf(pos, end - pos, "%s%u",
-				  i > 0 ? "," : "", freq_list[i]);
+		ret = os_snprintf(pos, end - pos, "%s%g",
+				  i > 0 ? "," : "", PR_KHZ(freq_list[i]));
 		if (os_snprintf_error(end - pos, ret))
 			return -1;
 		pos += ret;
@@ -8501,9 +8512,10 @@ static int wpas_ctrl_radio_work_show(struct wpa_supplicant *wpa_s,
 		int ret;
 
 		os_reltime_sub(&now, &work->time, &diff);
-		ret = os_snprintf(pos, end - pos, "%s@%s:%u:%u:%ld.%06ld\n",
-				  work->type, work->wpa_s->ifname, work->freq,
-				  work->started, diff.sec, diff.usec);
+		ret = os_snprintf(pos, end - pos, "%s@%s:%g:%u:%ld.%06ld\n",
+				  work->type, work->wpa_s->ifname,
+				  PR_KHZ(work->freq), work->started, diff.sec,
+				  diff.usec);
 		if (os_snprintf_error(end - pos, ret))
 			break;
 		pos += ret;
@@ -8581,7 +8593,7 @@ static int wpas_ctrl_radio_work_add(struct wpa_supplicant *wpa_s, char *cmd,
 
 		pos2 = os_strstr(pos, "freq=");
 		if (pos2)
-			freq = atoi(pos2 + 5);
+			freq = KHZ(atof(pos2 + 5));
 
 		pos2 = os_strstr(pos, "timeout=");
 		if (pos2)
@@ -8923,9 +8935,9 @@ static void wpas_ctrl_iface_mgmt_tx_cb(struct wpa_supplicant *wpa_s,
 				       enum offchannel_send_action_result
 				       result)
 {
-	wpa_msg(wpa_s, MSG_INFO, "MGMT-TX-STATUS freq=%u dst=" MACSTR
+	wpa_msg(wpa_s, MSG_INFO, "MGMT-TX-STATUS freq=%g dst=" MACSTR
 		" src=" MACSTR " bssid=" MACSTR " result=%s",
-		freq, MAC2STR(dst), MAC2STR(src), MAC2STR(bssid),
+		PR_KHZ(freq), MAC2STR(dst), MAC2STR(src), MAC2STR(bssid),
 		result == OFFCHANNEL_SEND_ACTION_SUCCESS ?
 		"SUCCESS" : (result == OFFCHANNEL_SEND_ACTION_NO_ACK ?
 			     "NO_ACK" : "FAILED"));
@@ -8960,7 +8972,7 @@ static int wpas_ctrl_iface_mgmt_tx(struct wpa_supplicant *wpa_s, char *cmd)
 	param = os_strstr(pos, " freq=");
 	if (param) {
 		param += 6;
-		freq = atoi(param);
+		freq = KHZ(atof(param));
 	}
 
 	param = os_strstr(pos, " no_cck=");
@@ -9029,7 +9041,7 @@ static int wpas_ctrl_iface_mgmt_rx_process(struct wpa_supplicant *wpa_s,
 	param = os_strstr(pos, "freq=");
 	if (param) {
 		param += 5;
-		freq = atoi(param);
+		freq = KHZ(atof(param));
 	}
 
 	param = os_strstr(pos, " datarate=");
@@ -9118,7 +9130,7 @@ static int wpas_ctrl_iface_driver_scan_res(struct wpa_supplicant *wpa_s,
 
 	pos = os_strstr(param, " freq=");
 	if (pos)
-		res->freq = atoi(pos + 6);
+		res->freq = KHZ(atof(pos + 6));
 
 	pos = os_strstr(param, " beacon_int=");
 	if (pos)
diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index 793a881efb0e..df38f1f34d5c 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -1595,7 +1595,7 @@ void wpas_dbus_signal_p2p_go_neg_resp(struct wpa_supplicant *wpa_s,
 						 res->role_go ? "GO" :
 						 "client") ||
 		    !wpa_dbus_dict_append_int32(&dict_iter, "frequency",
-						res->freq) ||
+						MHZ(res->freq)) ||
 		    !wpa_dbus_dict_append_byte_array(&dict_iter, "ssid",
 						     (const char *) res->ssid,
 						     res->ssid_len) ||
@@ -1616,7 +1616,7 @@ void wpas_dbus_signal_p2p_go_neg_resp(struct wpa_supplicant *wpa_s,
 
 		for (i = 0; i < P2P_MAX_CHANNELS; i++) {
 			if (res->freq_list[i]) {
-				freqs[i] = res->freq_list[i];
+				freqs[i] = MHZ(res->freq_list[i]);
 				freq_list_num++;
 			}
 		}
@@ -1868,7 +1868,7 @@ void wpas_dbus_signal_p2p_sd_request(struct wpa_supplicant *wpa_s,
 	if (!wpa_dbus_dict_open_write(&iter, &dict_iter) ||
 	    !wpa_dbus_dict_append_object_path(&dict_iter, "peer_object",
 					      path) ||
-	    !wpa_dbus_dict_append_int32(&dict_iter, "frequency", freq) ||
+	    !wpa_dbus_dict_append_int32(&dict_iter, "frequency", MHZ(freq)) ||
 	    !wpa_dbus_dict_append_int32(&dict_iter, "dialog_token",
 					dialog_token) ||
 	    !wpa_dbus_dict_append_uint16(&dict_iter, "update_indicator",
@@ -2174,7 +2174,7 @@ void wpas_dbus_signal_p2p_invitation_received(struct wpa_supplicant *wpa_s,
 					      ETH_ALEN)) ||
 	    (id &&
 	     !wpa_dbus_dict_append_int32(&dict_iter, "persistent_id", id)) ||
-	    !wpa_dbus_dict_append_int32(&dict_iter, "op_freq", op_freq) ||
+	    !wpa_dbus_dict_append_int32(&dict_iter, "op_freq", MHZ(op_freq)) ||
 	    !wpa_dbus_dict_close_write(&iter, &dict_iter)) {
 		dbus_message_unref(msg);
 		return;
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c
index d1f9607c602d..c7c8c4485a44 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers.c
@@ -1289,7 +1289,7 @@ static int wpas_dbus_get_scan_channels(DBusMessage *message,
 			return -1;
 		}
 
-		freqs[freqs_num] = freq;
+		freqs[freqs_num] = KHZ(freq);
 
 		freqs_num++;
 		dbus_message_iter_next(&array_iter);
@@ -1530,16 +1530,16 @@ DBusMessage * wpas_dbus_handler_signal_poll(DBusMessage *message,
 	    !wpa_dbus_dict_append_int32(&iter_dict, "noise",
 					si.current_noise) ||
 	    !wpa_dbus_dict_append_uint32(&iter_dict, "frequency",
-					 si.frequency) ||
+					 MHZ(si.frequency)) ||
 	    (si.chanwidth != CHAN_WIDTH_UNKNOWN &&
 	     !wpa_dbus_dict_append_string(
 		     &iter_dict, "width",
 		     channel_width_to_string(si.chanwidth))) ||
 	    (si.center_frq1 > 0 && si.center_frq2 > 0 &&
 	     (!wpa_dbus_dict_append_int32(&iter_dict, "center-frq1",
-					  si.center_frq1) ||
+					  MHZ(si.center_frq1)) ||
 	      !wpa_dbus_dict_append_int32(&iter_dict, "center-frq2",
-					  si.center_frq2))) ||
+					  MHZ(si.center_frq2)))) ||
 	    (si.avg_signal &&
 	     !wpa_dbus_dict_append_int32(&iter_dict, "avg-rssi",
 					 si.avg_signal)) ||
@@ -2417,16 +2417,16 @@ wpas_dbus_handler_tdls_channel_switch(DBusMessage *message,
 			oper_class = entry.byte_value;
 		} else if (os_strcmp(entry.key, "Frequency") == 0 &&
 			   entry.type == DBUS_TYPE_UINT32) {
-			freq_params.freq = entry.uint32_value;
+			freq_params.freq = KHZ(entry.uint32_value);
 		} else if (os_strcmp(entry.key, "SecChannelOffset") == 0 &&
 			   entry.type == DBUS_TYPE_UINT32) {
 			freq_params.sec_channel_offset = entry.uint32_value;
 		} else if (os_strcmp(entry.key, "CenterFrequency1") == 0 &&
 			   entry.type == DBUS_TYPE_UINT32) {
-			freq_params.center_freq1 = entry.uint32_value;
+			freq_params.center_freq1 = KHZ(entry.uint32_value);
 		} else if (os_strcmp(entry.key, "CenterFrequency2") == 0 &&
 			   entry.type == DBUS_TYPE_UINT32) {
-			freq_params.center_freq2 = entry.uint32_value;
+			freq_params.center_freq2 = KHZ(entry.uint32_value);
 		} else if (os_strcmp(entry.key, "Bandwidth") == 0 &&
 			   entry.type == DBUS_TYPE_UINT32) {
 			freq_params.bandwidth = entry.uint32_value;
@@ -2466,10 +2466,11 @@ wpas_dbus_handler_tdls_channel_switch(DBusMessage *message,
 	}
 
 	wpa_printf(MSG_DEBUG, "dbus: TDLS_CHAN_SWITCH " MACSTR
-		   " OP CLASS %d FREQ %d CENTER1 %d CENTER2 %d BW %d SEC_OFFSET %d%s%s",
-		   MAC2STR(peer), oper_class, freq_params.freq,
-		   freq_params.center_freq1, freq_params.center_freq2,
-		   freq_params.bandwidth, freq_params.sec_channel_offset,
+		   " OP CLASS %d FREQ %g CENTER1 %g CENTER2 %g BW %d SEC_OFFSET %d%s%s",
+		   MAC2STR(peer), oper_class, PR_KHZ(freq_params.freq),
+		   PR_KHZ(freq_params.center_freq1),
+		   PR_KHZ(freq_params.center_freq2), freq_params.bandwidth,
+		   freq_params.sec_channel_offset,
 		   freq_params.ht_enabled ? " HT" : "",
 		   freq_params.vht_enabled ? " VHT" : "");
 
@@ -4627,7 +4628,7 @@ dbus_bool_t wpas_dbus_getter_bss_frequency(
 	if (!res)
 		return FALSE;
 
-	freq = (u16) res->freq;
+	freq = (u16) MHZ(res->freq);
 	return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_UINT16,
 						&freq, error);
 }
diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
index 7a6567330407..aaf4ced2d707 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
@@ -162,7 +162,7 @@ DBusMessage * wpas_dbus_handler_p2p_find(DBusMessage *message,
 		} else if (os_strcmp(entry.key, "freq") == 0 &&
 			   (entry.type == DBUS_TYPE_INT32 ||
 			    entry.type == DBUS_TYPE_UINT32)) {
-			freq = entry.uint32_value;
+			freq = KHZ(entry.uint32_value);
 		} else
 			goto error_clear;
 		wpa_dbus_dict_entry_clear(&entry);
@@ -373,7 +373,7 @@ DBusMessage * wpas_dbus_handler_p2p_group_add(DBusMessage *message,
 			persistent_group = entry.bool_value;
 		} else if (os_strcmp(entry.key, "frequency") == 0 &&
 			   entry.type == DBUS_TYPE_INT32) {
-			freq = entry.int32_value;
+			freq = KHZ(entry.int32_value);
 			if (freq <= 0)
 				goto inv_args_clear;
 		} else if (os_strcmp(entry.key, "persistent_group_object") ==
@@ -608,7 +608,7 @@ DBusMessage * wpas_dbus_handler_p2p_connect(DBusMessage *message,
 			authorize_only = entry.bool_value;
 		} else if (os_strcmp(entry.key, "frequency") == 0 &&
 			   entry.type == DBUS_TYPE_INT32) {
-			freq = entry.int32_value;
+			freq = KHZ(entry.int32_value);
 			if (freq <= 0)
 				goto inv_args_clear;
 		} else if (os_strcmp(entry.key, "go_intent") == 0 &&
@@ -2435,11 +2435,11 @@ dbus_bool_t wpas_dbus_getter_p2p_group_frequency(
 	if (role == WPAS_P2P_ROLE_CLIENT) {
 		if (wpa_s->go_params == NULL)
 			return FALSE;
-		op_freq = wpa_s->go_params->freq;
+		op_freq = MHZ(wpa_s->go_params->freq);
 	} else {
 		if (wpa_s->ap_iface == NULL)
 			return FALSE;
-		op_freq = wpa_s->ap_iface->freq;
+		op_freq = MHZ(wpa_s->ap_iface->freq);
 	}
 
 	return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_UINT16,
@@ -2948,7 +2948,7 @@ DBusMessage * wpas_dbus_handler_p2p_service_sd_res(
 			peer_object_path = os_strdup(entry.str_value);
 		} else if (os_strcmp(entry.key, "frequency") == 0 &&
 			   entry.type == DBUS_TYPE_INT32) {
-			freq = entry.uint32_value;
+			freq = KHZ(entry.uint32_value);
 		} else if (os_strcmp(entry.key, "dialog_token") == 0 &&
 			   (entry.type == DBUS_TYPE_UINT32 ||
 			    entry.type == DBUS_TYPE_INT32)) {
diff --git a/wpa_supplicant/dpp_supplicant.c b/wpa_supplicant/dpp_supplicant.c
index 9c3776f1990d..cd3349cc1129 100644
--- a/wpa_supplicant/dpp_supplicant.c
+++ b/wpa_supplicant/dpp_supplicant.c
@@ -79,8 +79,8 @@ int wpas_dpp_qr_code(struct wpa_supplicant *wpa_s, const char *cmd)
 		wpa_printf(MSG_DEBUG,
 			   "DPP: Sending out pending authentication response");
 		wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR
-			" freq=%u type=%d",
-			MAC2STR(auth->peer_mac_addr), auth->curr_freq,
+			" freq=%g type=%d",
+			MAC2STR(auth->peer_mac_addr), PR_KHZ(auth->curr_freq),
 			DPP_PA_AUTHENTICATION_RESP);
 		offchannel_send_action(wpa_s, auth->curr_freq,
 				       auth->peer_mac_addr, wpa_s->own_addr,
@@ -190,8 +190,8 @@ static void wpas_dpp_auth_resp_retry_timeout(void *eloop_ctx, void *timeout_ctx)
 	wpa_printf(MSG_DEBUG,
 		   "DPP: Retry Authentication Response after timeout");
 	wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR
-		" freq=%u type=%d",
-		MAC2STR(auth->peer_mac_addr), auth->curr_freq,
+		" freq=%g type=%d",
+		MAC2STR(auth->peer_mac_addr), PR_KHZ(auth->curr_freq),
 		DPP_PA_AUTHENTICATION_RESP);
 	offchannel_send_action(wpa_s, auth->curr_freq, auth->peer_mac_addr,
 			       wpa_s->own_addr, broadcast,
@@ -389,8 +389,8 @@ void wpas_dpp_send_conn_status_result(struct wpa_supplicant *wpa_s,
 	}
 
 	wpa_msg(wpa_s, MSG_INFO,
-		DPP_EVENT_TX "dst=" MACSTR " freq=%u type=%d",
-		MAC2STR(auth->peer_mac_addr), auth->curr_freq,
+		DPP_EVENT_TX "dst=" MACSTR " freq=%g type=%d",
+		MAC2STR(auth->peer_mac_addr), PR_KHZ(auth->curr_freq),
 		DPP_PA_CONNECTION_STATUS_RESULT);
 	offchannel_send_action(wpa_s, auth->curr_freq,
 			       auth->peer_mac_addr, wpa_s->own_addr, broadcast,
@@ -428,10 +428,10 @@ static void wpas_dpp_tx_status(struct wpa_supplicant *wpa_s,
 	res_txt = result == OFFCHANNEL_SEND_ACTION_SUCCESS ? "SUCCESS" :
 		(result == OFFCHANNEL_SEND_ACTION_NO_ACK ? "no-ACK" :
 		 "FAILED");
-	wpa_printf(MSG_DEBUG, "DPP: TX status: freq=%u dst=" MACSTR
-		   " result=%s", freq, MAC2STR(dst), res_txt);
+	wpa_printf(MSG_DEBUG, "DPP: TX status: freq=%g dst=" MACSTR
+		   " result=%s", PR_KHZ(freq), MAC2STR(dst), res_txt);
 	wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX_STATUS "dst=" MACSTR
-		" freq=%u result=%s", MAC2STR(dst), freq, res_txt);
+		" freq=%g result=%s", MAC2STR(dst), PR_KHZ(freq), res_txt);
 
 	if (!wpa_s->dpp_auth) {
 		wpa_printf(MSG_DEBUG,
@@ -509,9 +509,9 @@ static void wpas_dpp_tx_status(struct wpa_supplicant *wpa_s,
 	if (!wpa_s->dpp_auth_ok_on_ack && wpa_s->dpp_auth->neg_freq > 0 &&
 	    wpa_s->dpp_auth->curr_freq != wpa_s->dpp_auth->neg_freq) {
 		wpa_printf(MSG_DEBUG,
-			   "DPP: Move from curr_freq %u MHz to neg_freq %u MHz for response",
-			   wpa_s->dpp_auth->curr_freq,
-			   wpa_s->dpp_auth->neg_freq);
+			   "DPP: Move from curr_freq %g MHz to neg_freq %g MHz for response",
+			   PR_KHZ(wpa_s->dpp_auth->curr_freq),
+			   PR_KHZ(wpa_s->dpp_auth->neg_freq));
 		offchannel_send_action_done(wpa_s);
 		wpas_dpp_listen_start(wpa_s, wpa_s->dpp_auth->neg_freq);
 	}
@@ -577,8 +577,8 @@ static void wpas_dpp_reply_wait_timeout(void *eloop_ctx, void *timeout_ctx)
 	if (auth->neg_freq > 0)
 		freq = auth->neg_freq;
 	wpa_printf(MSG_DEBUG,
-		   "DPP: Continue reply wait on channel %u MHz for %u ms",
-		   freq, wait_time);
+		   "DPP: Continue reply wait on channel %g MHz for %u ms",
+		   PR_KHZ(freq), wait_time);
 	wpa_s->dpp_in_response_listen = 1;
 	wpas_dpp_listen_start(wpa_s, freq);
 
@@ -690,11 +690,11 @@ static int wpas_dpp_auth_init_next(struct wpa_supplicant *wpa_s)
 	wait_time -= 10;
 	if (auth->neg_freq > 0 && freq != auth->neg_freq) {
 		wpa_printf(MSG_DEBUG,
-			   "DPP: Initiate on %u MHz and move to neg_freq %u MHz for response",
-			   freq, auth->neg_freq);
+			   "DPP: Initiate on %g MHz and move to neg_freq %g MHz for response",
+			   PR_KHZ(freq), PR_KHZ(auth->neg_freq));
 	}
-	wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%u type=%d",
-		MAC2STR(dst), freq, DPP_PA_AUTHENTICATION_REQ);
+	wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%g type=%d",
+		MAC2STR(dst), PR_KHZ(freq), DPP_PA_AUTHENTICATION_REQ);
 	auth->auth_req_ack = 0;
 	os_get_reltime(&wpa_s->dpp_last_init);
 	return offchannel_send_action(wpa_s, freq, dst,
@@ -798,7 +798,7 @@ int wpas_dpp_auth_init(struct wpa_supplicant *wpa_s, const char *cmd)
 
 	pos = os_strstr(cmd, " neg_freq=");
 	if (pos)
-		neg_freq = atoi(pos + 10);
+		neg_freq = KHZ(atof(pos + 10));
 
 	if (!tcp && wpa_s->dpp_auth) {
 		eloop_cancel_timeout(wpas_dpp_init_timeout, wpa_s, NULL);
@@ -891,8 +891,8 @@ static void dpp_start_listen_cb(struct wpa_radio_work *work, int deinit)
 	if (wpa_drv_remain_on_channel(wpa_s, lwork->freq,
 				      wpa_s->max_remain_on_chan) < 0) {
 		wpa_printf(MSG_DEBUG,
-			   "DPP: Failed to request the driver to remain on channel (%u MHz) for listen",
-			   lwork->freq);
+			   "DPP: Failed to request the driver to remain on channel (%g MHz) for listen",
+			   PR_KHZ(lwork->freq));
 		wpa_s->dpp_listen_freq = 0;
 		wpas_dpp_listen_work_done(wpa_s);
 		wpa_s->dpp_pending_listen_freq = 0;
@@ -938,7 +938,7 @@ int wpas_dpp_listen(struct wpa_supplicant *wpa_s, const char *cmd)
 {
 	int freq;
 
-	freq = atoi(cmd);
+	freq = KHZ(atof(cmd));
 	if (freq <= 0)
 		return -1;
 
@@ -957,8 +957,8 @@ int wpas_dpp_listen(struct wpa_supplicant *wpa_s, const char *cmd)
 	else
 		wpa_s->dpp_netrole = DPP_NETROLE_STA;
 	if (wpa_s->dpp_listen_freq == (unsigned int) freq) {
-		wpa_printf(MSG_DEBUG, "DPP: Already listening on %u MHz",
-			   freq);
+		wpa_printf(MSG_DEBUG, "DPP: Already listening on %g MHz",
+			   PR_KHZ(freq));
 		return 0;
 	}
 
@@ -972,8 +972,8 @@ void wpas_dpp_listen_stop(struct wpa_supplicant *wpa_s)
 	if (!wpa_s->dpp_listen_freq)
 		return;
 
-	wpa_printf(MSG_DEBUG, "DPP: Stop listen on %u MHz",
-		   wpa_s->dpp_listen_freq);
+	wpa_printf(MSG_DEBUG, "DPP: Stop listen on %g MHz",
+		   PR_KHZ(wpa_s->dpp_listen_freq));
 	wpa_drv_cancel_remain_on_channel(wpa_s);
 	wpa_drv_dpp_listen(wpa_s, false);
 	wpa_s->dpp_listen_freq = 0;
@@ -1013,8 +1013,8 @@ void wpas_dpp_cancel_remain_on_channel_cb(struct wpa_supplicant *wpa_s,
 		else
 			new_freq = wpa_s->dpp_auth->curr_freq;
 		wpa_printf(MSG_DEBUG,
-			   "DPP: Continue wait on %u MHz for the ongoing DPP provisioning session",
-			   new_freq);
+			   "DPP: Continue wait on %g MHz for the ongoing DPP provisioning session",
+			   PR_KHZ(new_freq));
 		wpas_dpp_listen_start(wpa_s, new_freq);
 		return;
 	}
@@ -1102,13 +1102,14 @@ static void wpas_dpp_rx_auth_req(struct wpa_supplicant *wpa_s, const u8 *src,
 	if (wpa_s->dpp_listen_freq &&
 	    wpa_s->dpp_listen_freq != wpa_s->dpp_auth->curr_freq) {
 		wpa_printf(MSG_DEBUG,
-			   "DPP: Stop listen on %u MHz to allow response on the request %u MHz",
-			   wpa_s->dpp_listen_freq, wpa_s->dpp_auth->curr_freq);
+			   "DPP: Stop listen on %g MHz to allow response on the request %g MHz",
+			   PR_KHZ(wpa_s->dpp_listen_freq),
+			   PR_KHZ(wpa_s->dpp_auth->curr_freq));
 		wpas_dpp_listen_stop(wpa_s);
 	}
 
-	wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%u type=%d",
-		MAC2STR(src), wpa_s->dpp_auth->curr_freq,
+	wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%g type=%d",
+		MAC2STR(src), PR_KHZ(wpa_s->dpp_auth->curr_freq),
 		DPP_PA_AUTHENTICATION_RESP);
 	offchannel_send_action(wpa_s, wpa_s->dpp_auth->curr_freq,
 			       src, wpa_s->own_addr, broadcast,
@@ -1615,8 +1616,8 @@ fail:
 			goto fail2;
 
 		wpa_msg(wpa_s, MSG_INFO,
-			DPP_EVENT_TX "dst=" MACSTR " freq=%u type=%d",
-			MAC2STR(addr), auth->curr_freq,
+			DPP_EVENT_TX "dst=" MACSTR " freq=%g type=%d",
+			MAC2STR(addr), PR_KHZ(auth->curr_freq),
 			DPP_PA_CONFIGURATION_RESULT);
 		offchannel_send_action(wpa_s, auth->curr_freq,
 				       addr, wpa_s->own_addr, broadcast,
@@ -1658,8 +1659,8 @@ static void wpas_dpp_start_gas_client(struct wpa_supplicant *wpa_s)
 		return;
 	}
 
-	wpa_printf(MSG_DEBUG, "DPP: GAS request to " MACSTR " (freq %u MHz)",
-		   MAC2STR(auth->peer_mac_addr), auth->curr_freq);
+	wpa_printf(MSG_DEBUG, "DPP: GAS request to " MACSTR " (freq %g MHz)",
+		   MAC2STR(auth->peer_mac_addr), PR_KHZ(auth->curr_freq));
 
 	res = gas_query_req(wpa_s->gas, auth->peer_mac_addr, auth->curr_freq,
 			    1, 1, buf, wpas_dpp_gas_resp_cb, wpa_s);
@@ -1705,7 +1706,7 @@ static void wpas_dpp_rx_auth_resp(struct wpa_supplicant *wpa_s, const u8 *src,
 	struct wpabuf *msg;
 
 	wpa_printf(MSG_DEBUG, "DPP: Authentication Response from " MACSTR
-		   " (freq %u MHz)", MAC2STR(src), freq);
+		   " (freq %g MHz)", MAC2STR(src), PR_KHZ(freq));
 
 	if (!auth) {
 		wpa_printf(MSG_DEBUG,
@@ -1743,8 +1744,9 @@ static void wpas_dpp_rx_auth_resp(struct wpa_supplicant *wpa_s, const u8 *src,
 	}
 	os_memcpy(auth->peer_mac_addr, src, ETH_ALEN);
 
-	wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%u type=%d",
-		MAC2STR(src), auth->curr_freq, DPP_PA_AUTHENTICATION_CONF);
+	wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%g type=%d",
+		MAC2STR(src), PR_KHZ(auth->curr_freq),
+		DPP_PA_AUTHENTICATION_CONF);
 	offchannel_send_action(wpa_s, auth->curr_freq,
 			       src, wpa_s->own_addr, broadcast,
 			       wpabuf_head(msg), wpabuf_len(msg),
@@ -2385,8 +2387,8 @@ static int wpas_dpp_allow_ir(struct wpa_supplicant *wpa_s, unsigned int freq)
 	}
 
 	wpa_printf(MSG_DEBUG,
-		   "DPP: Frequency %u MHz not supported or does not allow PKEX initiation in the current channel list",
-		   freq);
+		   "DPP: Frequency %g MHz not supported or does not allow PKEX initiation in the current channel list",
+		   PR_KHZ(freq));
 
 	return 0;
 }
@@ -2395,18 +2397,18 @@ static int wpas_dpp_allow_ir(struct wpa_supplicant *wpa_s, unsigned int freq)
 static int wpas_dpp_pkex_next_channel(struct wpa_supplicant *wpa_s,
 				      struct dpp_pkex *pkex)
 {
-	if (pkex->freq == 2437)
-		pkex->freq = 5745;
-	else if (pkex->freq == 5745)
-		pkex->freq = 5220;
-	else if (pkex->freq == 5220)
-		pkex->freq = 60480;
+	if (pkex->freq == KHZ(2437))
+		pkex->freq = KHZ(5745);
+	else if (pkex->freq == KHZ(5745))
+		pkex->freq = KHZ(5220);
+	else if (pkex->freq == KHZ(5220))
+		pkex->freq = KHZ(60480);
 	else
 		return -1; /* no more channels to try */
 
 	if (wpas_dpp_allow_ir(wpa_s, pkex->freq) == 1) {
-		wpa_printf(MSG_DEBUG, "DPP: Try to initiate on %u MHz",
-			   pkex->freq);
+		wpa_printf(MSG_DEBUG, "DPP: Try to initiate on %g MHz",
+			   PR_KHZ(pkex->freq));
 		return 0;
 	}
 
@@ -2436,8 +2438,9 @@ static void wpas_dpp_pkex_retry_timeout(void *eloop_ctx, void *timeout_ctx)
 	pkex->exch_req_tries++;
 	wpa_printf(MSG_DEBUG, "DPP: Retransmit PKEX Exchange Request (try %u)",
 		   pkex->exch_req_tries);
-	wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%u type=%d",
-		MAC2STR(broadcast), pkex->freq, DPP_PA_PKEX_EXCHANGE_REQ);
+	wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%g type=%d",
+		MAC2STR(broadcast), PR_KHZ(pkex->freq),
+		DPP_PA_PKEX_EXCHANGE_REQ);
 	offchannel_send_action(wpa_s, pkex->freq, broadcast,
 			       wpa_s->own_addr, broadcast,
 			       wpabuf_head(pkex->exchange_req),
@@ -2460,11 +2463,11 @@ wpas_dpp_tx_pkex_status(struct wpa_supplicant *wpa_s,
 	res_txt = result == OFFCHANNEL_SEND_ACTION_SUCCESS ? "SUCCESS" :
 		(result == OFFCHANNEL_SEND_ACTION_NO_ACK ? "no-ACK" :
 		 "FAILED");
-	wpa_printf(MSG_DEBUG, "DPP: TX status: freq=%u dst=" MACSTR
+	wpa_printf(MSG_DEBUG, "DPP: TX status: freq=%g dst=" MACSTR
 		   " result=%s (PKEX)",
-		   freq, MAC2STR(dst), res_txt);
+		   PR_KHZ(freq), MAC2STR(dst), res_txt);
 	wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX_STATUS "dst=" MACSTR
-		" freq=%u result=%s", MAC2STR(dst), freq, res_txt);
+		" freq=%g result=%s", MAC2STR(dst), PR_KHZ(freq), res_txt);
 
 	if (!pkex) {
 		wpa_printf(MSG_DEBUG,
@@ -2535,8 +2538,8 @@ wpas_dpp_rx_pkex_exchange_req(struct wpa_supplicant *wpa_s, const u8 *src,
 	wait_time = wpa_s->max_remain_on_chan;
 	if (wait_time > 2000)
 		wait_time = 2000;
-	wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%u type=%d",
-		MAC2STR(src), freq, DPP_PA_PKEX_EXCHANGE_RESP);
+	wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%g type=%d",
+		MAC2STR(src), PR_KHZ(freq), DPP_PA_PKEX_EXCHANGE_RESP);
 	offchannel_send_action(wpa_s, freq, src, wpa_s->own_addr,
 			       broadcast,
 			       wpabuf_head(msg), wpabuf_len(msg),
@@ -2578,8 +2581,8 @@ wpas_dpp_rx_pkex_exchange_resp(struct wpa_supplicant *wpa_s, const u8 *src,
 	wait_time = wpa_s->max_remain_on_chan;
 	if (wait_time > 2000)
 		wait_time = 2000;
-	wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%u type=%d",
-		MAC2STR(src), freq, DPP_PA_PKEX_COMMIT_REVEAL_REQ);
+	wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%g type=%d",
+		MAC2STR(src), PR_KHZ(freq), DPP_PA_PKEX_COMMIT_REVEAL_REQ);
 	offchannel_send_action(wpa_s, freq, src, wpa_s->own_addr,
 			       broadcast,
 			       wpabuf_head(msg), wpabuf_len(msg),
@@ -2638,8 +2641,8 @@ wpas_dpp_rx_pkex_commit_reveal_req(struct wpa_supplicant *wpa_s, const u8 *src,
 	wait_time = wpa_s->max_remain_on_chan;
 	if (wait_time > 2000)
 		wait_time = 2000;
-	wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%u type=%d",
-		MAC2STR(src), freq, DPP_PA_PKEX_COMMIT_REVEAL_RESP);
+	wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%g type=%d",
+		MAC2STR(src), PR_KHZ(freq), DPP_PA_PKEX_COMMIT_REVEAL_RESP);
 	offchannel_send_action(wpa_s, freq, src, wpa_s->own_addr,
 			       broadcast,
 			       wpabuf_head(msg), wpabuf_len(msg),
@@ -2714,25 +2717,25 @@ void wpas_dpp_rx_action(struct wpa_supplicant *wpa_s, const u8 *src,
 
 	wpa_printf(MSG_DEBUG,
 		   "DPP: Received DPP Public Action frame crypto suite %u type %d from "
-		   MACSTR " freq=%u",
-		   crypto_suite, type, MAC2STR(src), freq);
+		   MACSTR " freq=%g",
+		   crypto_suite, type, MAC2STR(src), PR_KHZ(freq));
 	if (crypto_suite != 1) {
 		wpa_printf(MSG_DEBUG, "DPP: Unsupported crypto suite %u",
 			   crypto_suite);
 		wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_RX "src=" MACSTR
-			" freq=%u type=%d ignore=unsupported-crypto-suite",
-			MAC2STR(src), freq, type);
+			" freq=%g type=%d ignore=unsupported-crypto-suite",
+			MAC2STR(src), PR_KHZ(freq), type);
 		return;
 	}
 	wpa_hexdump(MSG_MSGDUMP, "DPP: Received message attributes", buf, len);
 	if (dpp_check_attrs(buf, len) < 0) {
 		wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_RX "src=" MACSTR
-			" freq=%u type=%d ignore=invalid-attributes",
-			MAC2STR(src), freq, type);
+			" freq=%g type=%d ignore=invalid-attributes",
+			MAC2STR(src), PR_KHZ(freq), type);
 		return;
 	}
-	wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_RX "src=" MACSTR " freq=%u type=%d",
-		MAC2STR(src), freq, type);
+	wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_RX "src=" MACSTR " freq=%g type=%d",
+		MAC2STR(src), PR_KHZ(freq), type);
 
 	switch (type) {
 	case DPP_PA_AUTHENTICATION_REQ:
@@ -2950,11 +2953,11 @@ wpas_dpp_tx_introduction_status(struct wpa_supplicant *wpa_s,
 	res_txt = result == OFFCHANNEL_SEND_ACTION_SUCCESS ? "SUCCESS" :
 		(result == OFFCHANNEL_SEND_ACTION_NO_ACK ? "no-ACK" :
 		 "FAILED");
-	wpa_printf(MSG_DEBUG, "DPP: TX status: freq=%u dst=" MACSTR
+	wpa_printf(MSG_DEBUG, "DPP: TX status: freq=%g dst=" MACSTR
 		   " result=%s (DPP Peer Discovery Request)",
-		   freq, MAC2STR(dst), res_txt);
+		   PR_KHZ(freq), MAC2STR(dst), res_txt);
 	wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX_STATUS "dst=" MACSTR
-		" freq=%u result=%s", MAC2STR(dst), freq, res_txt);
+		" freq=%g result=%s", MAC2STR(dst), PR_KHZ(freq), res_txt);
 	/* TODO: Time out wait for response more quickly in error cases? */
 }
 
@@ -3073,8 +3076,9 @@ skip_connector:
 	wait_time = wpa_s->max_remain_on_chan;
 	if (wait_time > 2000)
 		wait_time = 2000;
-	wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%u type=%d",
-		MAC2STR(bss->bssid), bss->freq, DPP_PA_PEER_DISCOVERY_REQ);
+	wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%g type=%d",
+		MAC2STR(bss->bssid), PR_KHZ(bss->freq),
+		DPP_PA_PEER_DISCOVERY_REQ);
 	offchannel_send_action(wpa_s, bss->freq, bss->bssid, wpa_s->own_addr,
 			       broadcast,
 			       wpabuf_head(msg), wpabuf_len(msg),
@@ -3153,10 +3157,10 @@ int wpas_dpp_pkex_add(struct wpa_supplicant *wpa_s, const char *cmd)
 		wait_time = wpa_s->max_remain_on_chan;
 		if (wait_time > 2000)
 			wait_time = 2000;
-		pkex->freq = 2437;
+		pkex->freq = KHZ(2437);
 		wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR
-			" freq=%u type=%d",
-			MAC2STR(broadcast), pkex->freq,
+			" freq=%g type=%d",
+			MAC2STR(broadcast), PR_KHZ(pkex->freq),
 			DPP_PA_PKEX_EXCHANGE_REQ);
 		offchannel_send_action(wpa_s, pkex->freq, broadcast,
 				       wpa_s->own_addr, broadcast,
@@ -3342,8 +3346,8 @@ static void wpas_dpp_chirp_tx_status(struct wpa_supplicant *wpa_s,
 				     enum offchannel_send_action_result result)
 {
 	if (result == OFFCHANNEL_SEND_ACTION_FAILED) {
-		wpa_printf(MSG_DEBUG, "DPP: Failed to send chirp on %d MHz",
-			   wpa_s->dpp_chirp_freq);
+		wpa_printf(MSG_DEBUG, "DPP: Failed to send chirp on %g MHz",
+			   PR_KHZ(wpa_s->dpp_chirp_freq));
 		if (eloop_register_timeout(0, 0, wpas_dpp_chirp_next,
 					   wpa_s, NULL) < 0)
 			wpas_dpp_chirp_stop(wpa_s);
@@ -3370,9 +3374,10 @@ static void wpas_dpp_chirp_start(struct wpa_supplicant *wpa_s)
 			return;
 		type = DPP_PA_RECONFIG_ANNOUNCEMENT;
 	}
-	wpa_printf(MSG_DEBUG, "DPP: Chirp on %d MHz", wpa_s->dpp_chirp_freq);
-	wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%u type=%d",
-		MAC2STR(broadcast), wpa_s->dpp_chirp_freq, type);
+	wpa_printf(MSG_DEBUG, "DPP: Chirp on %g MHz",
+		   PR_KHZ(wpa_s->dpp_chirp_freq));
+	wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%g type=%d",
+		MAC2STR(broadcast), PR_KHZ(wpa_s->dpp_chirp_freq), type);
 	if (offchannel_send_action(
 		    wpa_s, wpa_s->dpp_chirp_freq, broadcast,
 		    wpa_s->own_addr, broadcast,
@@ -3407,7 +3412,7 @@ static void wpas_dpp_chirp_scan_res_handler(struct wpa_supplicant *wpa_s,
 	}
 
 	/* Preferred chirping channels */
-	int_array_add_unique(&wpa_s->dpp_chirp_freqs, 2437);
+	int_array_add_unique(&wpa_s->dpp_chirp_freqs, KHZ(2437));
 
 	mode = get_mode(wpa_s->hw.modes, wpa_s->hw.num_modes,
 			HOSTAPD_MODE_IEEE80211A, 0);
@@ -3420,15 +3425,17 @@ static void wpas_dpp_chirp_scan_res_handler(struct wpa_supplicant *wpa_s,
 			if (chan->flag & (HOSTAPD_CHAN_DISABLED |
 					  HOSTAPD_CHAN_RADAR))
 				continue;
-			if (chan->freq == 5220)
+			if (chan->freq == KHZ(5220))
 				chan44 = 1;
-			if (chan->freq == 5745)
+			if (chan->freq == KHZ(5745))
 				chan149 = 1;
 		}
 		if (chan149)
-			int_array_add_unique(&wpa_s->dpp_chirp_freqs, 5745);
+			int_array_add_unique(&wpa_s->dpp_chirp_freqs,
+					     KHZ(5745));
 		else if (chan44)
-			int_array_add_unique(&wpa_s->dpp_chirp_freqs, 5220);
+			int_array_add_unique(&wpa_s->dpp_chirp_freqs,
+					     KHZ(5220));
 	}
 
 	mode = get_mode(wpa_s->hw.modes, wpa_s->hw.num_modes,
@@ -3439,9 +3446,10 @@ static void wpas_dpp_chirp_scan_res_handler(struct wpa_supplicant *wpa_s,
 
 			if ((chan->flag & (HOSTAPD_CHAN_DISABLED |
 					   HOSTAPD_CHAN_RADAR)) ||
-			    chan->freq != 60480)
+			    chan->freq != KHZ(60480))
 				continue;
-			int_array_add_unique(&wpa_s->dpp_chirp_freqs, 60480);
+			int_array_add_unique(&wpa_s->dpp_chirp_freqs,
+					     KHZ(60480));
 			break;
 		}
 	}
@@ -3489,8 +3497,8 @@ static void wpas_dpp_chirp_next(void *eloop_ctx, void *timeout_ctx)
 				break;
 		if (!wpa_s->dpp_chirp_freqs[i]) {
 			wpa_printf(MSG_DEBUG,
-				   "DPP: Previous chirp freq %d not found",
-				   wpa_s->dpp_chirp_freq);
+				   "DPP: Previous chirp freq %g not found",
+				   PR_KHZ(wpa_s->dpp_chirp_freq));
 			return;
 		}
 		i++;
@@ -3555,7 +3563,7 @@ int wpas_dpp_chirp(struct wpa_supplicant *wpa_s, const char *cmd)
 
 	pos = os_strstr(cmd, " listen=");
 	if (pos) {
-		listen_freq = atoi(pos + 8);
+		listen_freq = KHZ(atof(pos + 8));
 		if (listen_freq <= 0)
 			return -1;
 	}
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index b93c62c8e05b..fc8b9ae913e1 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -913,9 +913,10 @@ static int rate_match(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
 				 */
 				if (debug_print)
 					wpa_dbg(wpa_s, MSG_DEBUG,
-						"   hardware does not support required rate %d.%d Mbps (freq=%d mode==%d num_rates=%d)",
+						"   hardware does not support required rate %d.%d Mbps (freq=%g mode==%d num_rates=%d)",
 						r / 10, r % 10,
-						bss->freq, mode->mode, mode->num_rates);
+						PR_KHZ(bss->freq), mode->mode,
+						mode->num_rates);
 				return 0;
 			}
 		}
@@ -1487,11 +1488,11 @@ struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
 
 	if (debug_print) {
 		wpa_dbg(wpa_s, MSG_DEBUG, "%d: " MACSTR
-			" ssid='%s' wpa_ie_len=%u rsn_ie_len=%u caps=0x%x level=%d freq=%d %s%s%s",
+			" ssid='%s' wpa_ie_len=%u rsn_ie_len=%u caps=0x%x level=%d freq=%g %s%s%s",
 			i, MAC2STR(bss->bssid),
 			wpa_ssid_txt(bss->ssid, bss->ssid_len),
 			wpa_ie_len, rsn_ie_len, bss->caps, bss->level,
-			bss->freq,
+			PR_KHZ(bss->freq),
 			wpa_bss_get_vendor_ie(bss, WPS_IE_VENDOR_TYPE) ?
 			" wps" : "",
 			(wpa_bss_get_vendor_ie(bss, P2P_IE_VENDOR_TYPE) ||
@@ -1584,9 +1585,9 @@ wpa_supplicant_select_bss(struct wpa_supplicant *wpa_s,
 			if (ssid != wpa_s->current_ssid)
 				continue;
 			wpa_dbg(wpa_s, MSG_DEBUG, "%u: " MACSTR
-				" freq=%d level=%d snr=%d est_throughput=%u",
-				i, MAC2STR(bss->bssid), bss->freq, bss->level,
-				bss->snr, bss->est_throughput);
+				" freq=%g level=%d snr=%d est_throughput=%u",
+				i, MAC2STR(bss->bssid), PR_KHZ(bss->freq),
+				bss->level, bss->snr, bss->est_throughput);
 		}
 	}
 
@@ -1903,14 +1904,14 @@ static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s,
 #ifndef CONFIG_NO_ROAMING
 	wpa_dbg(wpa_s, MSG_DEBUG, "Considering within-ESS reassociation");
 	wpa_dbg(wpa_s, MSG_DEBUG, "Current BSS: " MACSTR
-		" freq=%d level=%d snr=%d est_throughput=%u",
+		" freq=%g level=%d snr=%d est_throughput=%u",
 		MAC2STR(current_bss->bssid),
-		current_bss->freq, current_bss->level,
+		PR_KHZ(current_bss->freq), current_bss->level,
 		current_bss->snr, current_bss->est_throughput);
 	wpa_dbg(wpa_s, MSG_DEBUG, "Selected BSS: " MACSTR
-		" freq=%d level=%d snr=%d est_throughput=%u",
-		MAC2STR(selected->bssid), selected->freq, selected->level,
-		selected->snr, selected->est_throughput);
+		" freq=%g level=%d snr=%d est_throughput=%u",
+		MAC2STR(selected->bssid), PR_KHZ(selected->freq),
+		selected->level, selected->snr, selected->est_throughput);
 
 	if (wpa_s->current_ssid->bssid_set &&
 	    os_memcmp(selected->bssid, wpa_s->current_ssid->bssid, ETH_ALEN) ==
@@ -1960,7 +1961,8 @@ static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s,
 		return 1;
 	}
 
-	to_5ghz = selected->freq > 4000 && current_bss->freq < 4000;
+	to_5ghz = selected->freq > KHZ(4000) &&
+		  current_bss->freq < KHZ(4000);
 
 	if (cur_level < 0 && cur_level > selected->level + to_5ghz * 2 &&
 	    sel_est < cur_est * 1.2) {
@@ -2693,8 +2695,8 @@ static int wpa_supplicant_event_associnfo(struct wpa_supplicant *wpa_s,
 			    data->assoc_info.beacon_ies,
 			    data->assoc_info.beacon_ies_len);
 	if (data->assoc_info.freq)
-		wpa_dbg(wpa_s, MSG_DEBUG, "freq=%u MHz",
-			data->assoc_info.freq);
+		wpa_dbg(wpa_s, MSG_DEBUG, "freq=%g MHz",
+			PR_KHZ(data->assoc_info.freq));
 
 	wpa_s->connection_set = 0;
 	if (data->assoc_info.req_ies && data->assoc_info.resp_ies) {
@@ -2937,8 +2939,9 @@ no_pfs:
 	if (wpa_s->assoc_freq && data->assoc_info.freq &&
 	    wpa_s->assoc_freq != data->assoc_info.freq) {
 		wpa_printf(MSG_DEBUG, "Operating frequency changed from "
-			   "%u to %u MHz",
-			   wpa_s->assoc_freq, data->assoc_info.freq);
+			   "%g to %g MHz",
+			   PR_KHZ(wpa_s->assoc_freq),
+			   PR_KHZ(data->assoc_info.freq));
 		wpa_supplicant_update_scan_results(wpa_s);
 	}
 
@@ -4110,8 +4113,8 @@ static void wpas_event_rx_mgmt_action(struct wpa_supplicant *wpa_s,
 	plen = len - IEEE80211_HDRLEN - 1;
 
 	wpa_dbg(wpa_s, MSG_DEBUG, "Received Action frame: SA=" MACSTR
-		" Category=%u DataLen=%d freq=%d MHz",
-		MAC2STR(mgmt->sa), category, (int) plen, freq);
+		" Category=%u DataLen=%d freq=%g MHz",
+		MAC2STR(mgmt->sa), category, (int) plen, PR_KHZ(freq));
 
 	if (category == WLAN_ACTION_WMM) {
 		wmm_ac_rx_action(wpa_s, mgmt->da, mgmt->sa, payload, plen);
@@ -4307,7 +4310,8 @@ static void wpas_event_dfs_cac_started(struct wpa_supplicant *wpa_s,
 	} else
 #endif /* NEED_AP_MLME && CONFIG_AP */
 	{
-		unsigned int cac_time = wpas_event_cac_ms(wpa_s, radar->freq);
+		unsigned int cac_time = wpas_event_cac_ms(wpa_s,
+						KHZ(radar->freq));
 
 		cac_time /= 1000; /* convert from ms to sec */
 		if (!cac_time)
@@ -4879,15 +4883,15 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
 			break;
 
 		wpa_msg(wpa_s, MSG_INFO,
-			"%sfreq=%d ht_enabled=%d ch_offset=%d ch_width=%s cf1=%d cf2=%d",
+			"%sfreq=%g ht_enabled=%d ch_offset=%d ch_width=%s cf1=%g cf2=%g",
 			event == EVENT_CH_SWITCH ? WPA_EVENT_CHANNEL_SWITCH :
 			WPA_EVENT_CHANNEL_SWITCH_STARTED,
-			data->ch_switch.freq,
+			PR_KHZ(data->ch_switch.freq),
 			data->ch_switch.ht_enabled,
 			data->ch_switch.ch_offset,
 			channel_width_to_string(data->ch_switch.ch_width),
-			data->ch_switch.cf1,
-			data->ch_switch.cf2);
+			PR_KHZ(data->ch_switch.cf1),
+			PR_KHZ(data->ch_switch.cf2));
 		if (event == EVENT_CH_SWITCH_STARTED)
 			break;
 
@@ -4966,8 +4970,8 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
 			if (hex) {
 				wpa_snprintf_hex(hex, hex_len,
 						 rx->frame, rx->frame_len);
-				wpa_msg(wpa_s, MSG_INFO, "MGMT-RX freq=%d datarate=%u ssi_signal=%d %s",
-					rx->freq, rx->datarate, rx->ssi_signal,
+				wpa_msg(wpa_s, MSG_INFO, "MGMT-RX freq=%g datarate=%u ssi_signal=%d %s",
+					PR_KHZ(rx->freq), rx->datarate, rx->ssi_signal,
 					hex);
 				os_free(hex);
 			}
diff --git a/wpa_supplicant/gas_query.c b/wpa_supplicant/gas_query.c
index 4b3fcfcfa647..2eb2083eb83d 100644
--- a/wpa_supplicant/gas_query.c
+++ b/wpa_supplicant/gas_query.c
@@ -157,8 +157,8 @@ static void gas_query_done(struct gas_query *gas,
 			   enum gas_query_result result)
 {
 	wpa_msg(gas->wpa_s, MSG_INFO, GAS_QUERY_DONE "addr=" MACSTR
-		" dialog_token=%u freq=%d status_code=%u result=%s",
-		MAC2STR(query->addr), query->dialog_token, query->freq,
+		" dialog_token=%u freq=%g status_code=%u result=%s",
+		MAC2STR(query->addr), query->dialog_token, PR_KHZ(query->freq),
 		query->status_code, gas_result_txt(result));
 	if (gas->current == query)
 		gas->current = NULL;
@@ -229,18 +229,19 @@ static void gas_query_tx_status(struct wpa_supplicant *wpa_s,
 	int dur;
 
 	if (gas->current == NULL) {
-		wpa_printf(MSG_DEBUG, "GAS: Unexpected TX status: freq=%u dst="
+		wpa_printf(MSG_DEBUG, "GAS: Unexpected TX status: freq=%g dst="
 			   MACSTR " result=%d - no query in progress",
-			   freq, MAC2STR(dst), result);
+			   PR_KHZ(freq), MAC2STR(dst), result);
 		return;
 	}
 
 	query = gas->current;
 
 	dur = ms_from_time(&query->last_oper);
-	wpa_printf(MSG_DEBUG, "GAS: TX status: freq=%u dst=" MACSTR
+	wpa_printf(MSG_DEBUG, "GAS: TX status: freq=%g dst=" MACSTR
 		   " result=%d query=%p dialog_token=%u dur=%d ms",
-		   freq, MAC2STR(dst), result, query, query->dialog_token, dur);
+		   PR_KHZ(freq), MAC2STR(dst), result, query,
+		   query->dialog_token, dur);
 	if (os_memcmp(dst, query->addr, ETH_ALEN) != 0) {
 		wpa_printf(MSG_DEBUG, "GAS: TX status for unexpected destination");
 		return;
@@ -293,9 +294,9 @@ static int gas_query_tx(struct gas_query *gas, struct gas_query_pending *query,
 	};
 
 	wpa_printf(MSG_DEBUG, "GAS: Send action frame to " MACSTR " len=%u "
-		   "freq=%d prot=%d using src addr " MACSTR,
+		   "freq=%g prot=%d using src addr " MACSTR,
 		   MAC2STR(query->addr), (unsigned int) wpabuf_len(req),
-		   query->freq, prot, MAC2STR(query->sa));
+		   PR_KHZ(query->freq), prot, MAC2STR(query->sa));
 	if (prot) {
 		u8 *categ = wpabuf_mhead_u8(req);
 		*categ = WLAN_ACTION_PROTECTED_DUAL;
@@ -817,7 +818,7 @@ static int gas_query_set_sa(struct gas_query *gas,
  * gas_query_req - Request a GAS query
  * @gas: GAS query data from gas_query_init()
  * @dst: Destination MAC address for the query
- * @freq: Frequency (in MHz) for the channel on which to send the query
+ * @freq: Frequency (in KHz) for the channel on which to send the query
  * @wildcard_bssid: Force use of wildcard BSSID value
  * @maintain_addr: Maintain own MAC address for exchange (i.e., ignore MAC
  *	address randomization rules)
@@ -867,8 +868,8 @@ int gas_query_req(struct gas_query *gas, const u8 *dst, int freq,
 	*(wpabuf_mhead_u8(req) + 2) = dialog_token;
 
 	wpa_msg(gas->wpa_s, MSG_INFO, GAS_QUERY_START "addr=" MACSTR
-		" dialog_token=%u freq=%d",
-		MAC2STR(query->addr), query->dialog_token, query->freq);
+		" dialog_token=%u freq=%g", MAC2STR(query->addr),
+		query->dialog_token, PR_KHZ(query->freq));
 
 	if (radio_add_work(gas->wpa_s, freq, "gas-query", 0, gas_query_start_cb,
 			   query) < 0) {
diff --git a/wpa_supplicant/interworking.c b/wpa_supplicant/interworking.c
index b1ddd0925fd1..9d744bdb82cb 100644
--- a/wpa_supplicant/interworking.c
+++ b/wpa_supplicant/interworking.c
@@ -3222,7 +3222,7 @@ int gas_send_request(struct wpa_supplicant *wpa_s, const u8 *dst,
 	if (freq <= 0)
 		return -1;
 
-	wpa_msg(wpa_s, MSG_DEBUG, "GAS request to " MACSTR " (freq %d MHz)",
+	wpa_msg(wpa_s, MSG_DEBUG, "GAS request to " MACSTR " (freq %d KHz)",
 		MAC2STR(dst), freq);
 	wpa_hexdump_buf(MSG_DEBUG, "Advertisement Protocol ID", adv_proto);
 	wpa_hexdump_buf(MSG_DEBUG, "GAS Query", query);
diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c
index c085466b1e71..11aae9bc3fa8 100644
--- a/wpa_supplicant/mesh.c
+++ b/wpa_supplicant/mesh.c
@@ -287,7 +287,7 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s,
 	bss->mesh_sta_free_cb = mesh_mpm_free_sta;
 	frequency = ssid->frequency;
 	if (frequency != freq->freq &&
-	    frequency == freq->freq + freq->sec_channel_offset * 20) {
+	    frequency == freq->freq + KHZ(freq->sec_channel_offset * 20)) {
 		wpa_printf(MSG_DEBUG, "mesh: pri/sec channels switched");
 		frequency = freq->freq;
 	}
@@ -329,8 +329,8 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s,
 	/* need conf->hw_mode for supported rates. */
 	conf->hw_mode = ieee80211_freq_to_chan(frequency, &conf->channel);
 	if (conf->hw_mode == NUM_HOSTAPD_MODES) {
-		wpa_printf(MSG_ERROR, "Unsupported mesh mode frequency: %d MHz",
-			   frequency);
+		wpa_printf(MSG_ERROR, "Unsupported mesh mode frequency: %g MHz",
+			   PR_KHZ(frequency));
 		goto out_free;
 	}
 	if (ssid->ht40)
@@ -342,13 +342,13 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s,
 		case CHANWIDTH_80MHZ:
 		case CHANWIDTH_80P80MHZ:
 			ieee80211_freq_to_chan(
-				frequency,
+				KHZ(frequency),
 				&conf->vht_oper_centr_freq_seg0_idx);
 			conf->vht_oper_centr_freq_seg0_idx += ssid->ht40 * 2;
 			break;
 		case CHANWIDTH_160MHZ:
 			ieee80211_freq_to_chan(
-				frequency,
+				KHZ(frequency),
 				&conf->vht_oper_centr_freq_seg0_idx);
 			conf->vht_oper_centr_freq_seg0_idx += ssid->ht40 * 2;
 			conf->vht_oper_centr_freq_seg0_idx += 40 / 5;
diff --git a/wpa_supplicant/offchannel.c b/wpa_supplicant/offchannel.c
index e40cf5bbebcd..419d69284059 100644
--- a/wpa_supplicant/offchannel.c
+++ b/wpa_supplicant/offchannel.c
@@ -99,11 +99,11 @@ static void wpas_send_action_cb(void *eloop_ctx, void *timeout_ctx)
 	    wpa_s->pending_action_freq != 0 &&
 	    wpa_s->pending_action_freq != iface->assoc_freq) {
 		wpa_printf(MSG_DEBUG, "Off-channel: Pending Action frame TX "
-			   "waiting for another freq=%u (off_channel_freq=%u "
-			   "assoc_freq=%u)",
-			   wpa_s->pending_action_freq,
-			   wpa_s->off_channel_freq,
-			   iface->assoc_freq);
+			   "waiting for another freq=%g (off_channel_freq=%g "
+			   "assoc_freq=%g)",
+			   PR_KHZ(wpa_s->pending_action_freq),
+			   PR_KHZ(wpa_s->off_channel_freq),
+			   PR_KHZ(iface->assoc_freq));
 		if (without_roc && wpa_s->off_channel_freq == 0) {
 			unsigned int duration = 200;
 			/*
@@ -267,9 +267,9 @@ int offchannel_send_action(struct wpa_supplicant *wpa_s, unsigned int freq,
 					 result),
 			   int no_cck)
 {
-	wpa_printf(MSG_DEBUG, "Off-channel: Send action frame: freq=%d dst="
+	wpa_printf(MSG_DEBUG, "Off-channel: Send action frame: freq=%g dst="
 		   MACSTR " src=" MACSTR " bssid=" MACSTR " len=%d",
-		   freq, MAC2STR(dst), MAC2STR(src), MAC2STR(bssid),
+		   PR_KHZ(freq), MAC2STR(dst), MAC2STR(src), MAC2STR(bssid),
 		   (int) len);
 
 	wpa_s->pending_action_tx_status_cb = tx_cb;
@@ -392,10 +392,10 @@ int offchannel_send_action(struct wpa_supplicant *wpa_s, unsigned int freq,
 void offchannel_send_action_done(struct wpa_supplicant *wpa_s)
 {
 	wpa_printf(MSG_DEBUG,
-		   "Off-channel: Action frame sequence done notification: pending_action_tx=%p drv_offchan_tx=%d action_tx_wait_time=%d off_channel_freq=%d roc_waiting_drv_freq=%d",
+		   "Off-channel: Action frame sequence done notification: pending_action_tx=%p drv_offchan_tx=%d action_tx_wait_time=%d off_channel_freq=%g roc_waiting_drv_freq=%d",
 		   wpa_s->pending_action_tx,
 		   !!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_OFFCHANNEL_TX),
-		   wpa_s->action_tx_wait_time, wpa_s->off_channel_freq,
+		   wpa_s->action_tx_wait_time, PR_KHZ(wpa_s->off_channel_freq),
 		   wpa_s->roc_waiting_drv_freq);
 	wpabuf_free(wpa_s->pending_action_tx);
 	wpa_s->pending_action_tx = NULL;
@@ -432,7 +432,7 @@ void offchannel_remain_on_channel_cb(struct wpa_supplicant *wpa_s,
 /**
  * offchannel_cancel_remain_on_channel_cb - Remain-on-channel stopped callback
  * @wpa_s: Pointer to wpa_supplicant data
- * @freq: Frequency (in MHz) of the selected channel
+ * @freq: Frequency (in KHz) of the selected channel
  *
  * This function is called whenever the driver notifies termination of a
  * remain-on-channel operation.
diff --git a/wpa_supplicant/op_classes.c b/wpa_supplicant/op_classes.c
index 983801faa421..af84135e60ac 100644
--- a/wpa_supplicant/op_classes.c
+++ b/wpa_supplicant/op_classes.c
@@ -27,8 +27,8 @@ static enum chan_allowed allow_channel(struct hostapd_hw_modes *mode,
 	for (i = 0; i < mode->num_channels; i++) {
 		int chan_is_6ghz;
 
-		chan_is_6ghz = mode->channels[i].freq > 5940 &&
-			mode->channels[i].freq <= 7105;
+		chan_is_6ghz = mode->channels[i].freq > KHZ(5940) &&
+			mode->channels[i].freq <= KHZ(7105);
 		if (is_6ghz == chan_is_6ghz && mode->channels[i].chan == chan)
 			break;
 	}
@@ -242,9 +242,9 @@ static int wpas_op_class_supported(struct wpa_supplicant *wpa_s,
 
 			if (f == 0)
 				break; /* end of list */
-			if (f > 4000 && f < 6000)
+			if (f > KHZ(4000) && f < KHZ(6000))
 				freq5 = 1;
-			else if (f > 2400 && f < 2500)
+			else if (f > KHZ(2400) && f < KHZ(2500))
 				freq2 = 1;
 		}
 	} else {
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index e94bffe529c1..f532f7183ac9 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -336,7 +336,7 @@ static int wpas_p2p_search_social_channel(struct wpa_supplicant *wpa_s,
 					  int freq)
 {
 	if (wpa_s->global->p2p_24ghz_social_channels &&
-	    (freq == 2412 || freq == 2437 || freq == 2462)) {
+	    (freq == KHZ(2412) || freq == KHZ(2437) || freq == KHZ(2462))) {
 		/*
 		 * Search all social channels regardless of whether these have
 		 * been disabled for P2P operating channel use to avoid missing
@@ -356,7 +356,8 @@ static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq,
 	struct wpa_driver_scan_params *params = NULL;
 	struct wpabuf *wps_ie, *ies;
 	unsigned int num_channels = 0;
-	int social_channels_freq[] = { 2412, 2437, 2462, 60480 };
+	int social_channels_freq[] = { KHZ(2412), KHZ(2437), KHZ(2462),
+				       KHZ(60480) };
 	size_t ielen;
 	u8 *n, i;
 	unsigned int bands;
@@ -1287,18 +1288,18 @@ static void wpas_p2p_group_started(struct wpa_supplicant *wpa_s,
 	 */
 	wpa_msg_global_ctrl(wpa_s->p2pdev, MSG_INFO,
 			    P2P_EVENT_GROUP_STARTED
-			    "%s %s ssid=\"%s\" freq=%d%s%s%s%s%s go_dev_addr="
+			    "%s %s ssid=\"%s\" freq=%g%s%s%s%s%s go_dev_addr="
 			    MACSTR "%s%s",
-			    wpa_s->ifname, go ? "GO" : "client", ssid_txt, freq,
-			    psk ? " psk=" : "", psk_txt,
+			    wpa_s->ifname, go ? "GO" : "client", ssid_txt,
+			    PR_KHZ(freq), psk ? " psk=" : "", psk_txt,
 			    passphrase ? " passphrase=\"" : "",
 			    passphrase ? passphrase : "",
 			    passphrase ? "\"" : "",
 			    MAC2STR(go_dev_addr),
 			    persistent ? " [PERSISTENT]" : "", extra);
 	wpa_printf(MSG_INFO, P2P_EVENT_GROUP_STARTED
-		   "%s %s ssid=\"%s\" freq=%d go_dev_addr=" MACSTR "%s%s",
-		   wpa_s->ifname, go ? "GO" : "client", ssid_txt, freq,
+		   "%s %s ssid=\"%s\" freq=%g go_dev_addr=" MACSTR "%s%s",
+		   wpa_s->ifname, go ? "GO" : "client", ssid_txt, PR_KHZ(freq),
 		   MAC2STR(go_dev_addr), persistent ? " [PERSISTENT]" : "",
 		   extra);
 }
@@ -1419,9 +1420,9 @@ static void wpas_p2p_free_send_action_work(struct wpa_supplicant *wpa_s)
 	struct send_action_work *awork = wpa_s->p2p_send_action_work->ctx;
 
 	wpa_printf(MSG_DEBUG,
-		   "P2P: Free Action frame radio work @%p (freq=%u dst="
+		   "P2P: Free Action frame radio work @%p (freq=%g dst="
 		   MACSTR " src=" MACSTR " bssid=" MACSTR " wait_time=%u)",
-		   wpa_s->p2p_send_action_work, awork->freq,
+		   wpa_s->p2p_send_action_work, PR_KHZ(awork->freq),
 		   MAC2STR(awork->dst), MAC2STR(awork->src),
 		   MAC2STR(awork->bssid), awork->wait_time);
 	wpa_hexdump(MSG_DEBUG, "P2P: Freeing pending Action frame",
@@ -1599,8 +1600,8 @@ static int wpas_send_action(void *ctx, unsigned int freq, const u8 *dst,
 	if (listen_freq != (int) freq && send_freq != (int) freq) {
 		int res;
 
-		wpa_printf(MSG_DEBUG, "P2P: Schedule new radio work for Action frame TX (listen_freq=%d send_freq=%d freq=%u)",
-			   listen_freq, send_freq, freq);
+		wpa_printf(MSG_DEBUG, "P2P: Schedule new radio work for Action frame TX (listen_freq=%g send_freq=%g freq=%g)",
+			   PR_KHZ(listen_freq), PR_KHZ(send_freq), PR_KHZ(freq));
 		res = wpas_send_action_work(wpa_s, freq, dst, src, bssid, buf,
 					    len, wait_time);
 		if (res == 0 && scheduled)
@@ -1730,8 +1731,8 @@ static void p2p_go_dump_common_freqs(struct wpa_supplicant *wpa_s)
 	pos = buf;
 	end = pos + sizeof(buf);
 	for (i = 0; i < wpa_s->p2p_group_common_freqs_num; i++) {
-		res = os_snprintf(pos, end - pos, " %d",
-				  wpa_s->p2p_group_common_freqs[i]);
+		res = os_snprintf(pos, end - pos, " %g",
+				  PR_KHZ(wpa_s->p2p_group_common_freqs[i]));
 		if (os_snprintf_error(end - pos, res))
 			break;
 		pos += res;
@@ -1947,13 +1948,13 @@ int wpas_p2p_try_edmg_channel(struct wpa_supplicant *wpa_s,
 	int freq;
 
 	/* Try social channel as primary channel frequency */
-	freq = (!params->freq) ? 58320 + 1 * 2160 : params->freq;
+	freq = (!params->freq) ? KHZ(58320 + 1 * 2160) : params->freq;
 
 	if (wpas_p2p_freq_to_edmg_channel(wpa_s, freq, &op_class,
 					  &op_channel) == 0) {
 		wpa_printf(MSG_DEBUG,
-			   "Freq %d will be used to set an EDMG connection (channel=%u opclass=%u)",
-			   freq, op_channel, op_class);
+			   "Freq %g will be used to set an EDMG connection (channel=%u opclass=%u)",
+			   PR_KHZ(freq), op_channel, op_class);
 		params->freq = freq;
 		return 0;
 	}
@@ -2007,8 +2008,8 @@ static void wpas_start_wps_go(struct wpa_supplicant *wpa_s,
 			ssid->enable_edmg = params->edmg;
 		} else {
 			wpa_dbg(wpa_s, MSG_DEBUG,
-				"P2P: Could not match EDMG channel, freq %d, for GO",
-				params->freq);
+				"P2P: Could not match EDMG channel, freq %g, for GO",
+				PR_KHZ(params->freq));
 		}
 	}
 
@@ -2022,7 +2023,7 @@ static void wpas_start_wps_go(struct wpa_supplicant *wpa_s,
 	ssid->proto = WPA_PROTO_RSN;
 	ssid->pairwise_cipher = WPA_CIPHER_CCMP;
 	ssid->group_cipher = WPA_CIPHER_CCMP;
-	if (params->freq > 56160) {
+	if (params->freq > KHZ(56160)) {
 		/*
 		 * Enable GCMP instead of CCMP as pairwise_cipher and
 		 * group_cipher in 60 GHz.
@@ -2367,10 +2368,10 @@ static void wpas_go_neg_completed(void *ctx, struct p2p_go_neg_results *res)
 	res->vht_center_freq2 = wpa_s->p2p_go_vht_center_freq2;
 
 	wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_GO_NEG_SUCCESS "role=%s "
-		       "freq=%d ht40=%d peer_dev=" MACSTR " peer_iface=" MACSTR
+		       "freq=%g ht40=%d peer_dev=" MACSTR " peer_iface=" MACSTR
 		       " wps_method=%s",
-		       res->role_go ? "GO" : "client", res->freq, res->ht40,
-		       MAC2STR(res->peer_device_addr),
+		       res->role_go ? "GO" : "client", PR_KHZ(res->freq),
+		       res->ht40, MAC2STR(res->peer_device_addr),
 		       MAC2STR(res->peer_interface_addr),
 		       p2p_wps_method_text(res->wps_method));
 	wpas_notify_p2p_go_neg_completed(wpa_s, res);
@@ -3164,16 +3165,18 @@ static void wpas_invitation_received(void *ctx, const u8 *sa, const u8 *bssid,
 
 	if (status == P2P_SC_SUCCESS) {
 		wpa_printf(MSG_DEBUG, "P2P: Invitation from peer " MACSTR
-			   " was accepted; op_freq=%d MHz, SSID=%s",
-			   MAC2STR(sa), op_freq, wpa_ssid_txt(ssid, ssid_len));
+			   " was accepted; op_freq=%g MHz, SSID=%s",
+			   MAC2STR(sa), PR_KHZ(op_freq), wpa_ssid_txt(ssid,
+								      ssid_len));
 		if (s) {
 			int go = s->mode == WPAS_MODE_P2P_GO;
 			if (go) {
 				wpa_msg_global(wpa_s, MSG_INFO,
 					       P2P_EVENT_INVITATION_ACCEPTED
 					       "sa=" MACSTR
-					       " persistent=%d freq=%d",
-					       MAC2STR(sa), s->id, op_freq);
+					       " persistent=%d freq=%g",
+					       MAC2STR(sa), s->id,
+					       PR_KHZ(op_freq));
 			} else {
 				wpa_msg_global(wpa_s, MSG_INFO,
 					       P2P_EVENT_INVITATION_ACCEPTED
@@ -3233,8 +3236,8 @@ static void wpas_invitation_received(void *ctx, const u8 *sa, const u8 *bssid,
 
 	if (s->mode == WPAS_MODE_P2P_GO && op_freq) {
 		wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_INVITATION_RECEIVED
-			       "sa=" MACSTR " persistent=%d freq=%d",
-			       MAC2STR(sa), s->id, op_freq);
+			       "sa=" MACSTR " persistent=%d freq=%g",
+			       MAC2STR(sa), s->id, PR_KHZ(op_freq));
 	} else {
 		wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_INVITATION_RECEIVED
 			       "sa=" MACSTR " persistent=%d",
@@ -3404,8 +3407,8 @@ static void wpas_invitation_result(void *ctx, int status, const u8 *bssid,
 	else
 		freq = 0;
 
-	wpa_printf(MSG_DEBUG, "P2P: Persistent group invitation success - op_freq=%d MHz SSID=%s",
-		   freq, wpa_ssid_txt(ssid->ssid, ssid->ssid_len));
+	wpa_printf(MSG_DEBUG, "P2P: Persistent group invitation success - op_freq=%g MHz SSID=%s",
+		   PR_KHZ(freq), wpa_ssid_txt(ssid->ssid, ssid->ssid_len));
 	wpas_p2p_group_add_persistent(wpa_s, ssid,
 				      ssid->mode == WPAS_MODE_P2P_GO,
 				      wpa_s->p2p_persistent_go_freq,
@@ -3455,7 +3458,7 @@ static int wpas_p2p_default_channels(struct wpa_supplicant *wpa_s,
 	chan->reg_class[cla].reg_class = 81;
 	chan->reg_class[cla].channels = 0;
 	for (i = 0; i < 11; i++) {
-		if (!wpas_p2p_disallowed_freq(wpa_s->global, 2412 + i * 5))
+		if (!wpas_p2p_disallowed_freq(wpa_s->global, KHZ(2412 + i * 5)))
 			wpas_p2p_add_chan(&chan->reg_class[cla], i + 1);
 	}
 	if (chan->reg_class[cla].channels)
@@ -3467,13 +3470,13 @@ static int wpas_p2p_default_channels(struct wpa_supplicant *wpa_s,
 	/* Operating class 115 - 5 GHz, channels 36-48 */
 	chan->reg_class[cla].reg_class = 115;
 	chan->reg_class[cla].channels = 0;
-	if (!wpas_p2p_disallowed_freq(wpa_s->global, 5000 + 36 * 5))
+	if (!wpas_p2p_disallowed_freq(wpa_s->global, KHZ(5000 + 36 * 5)))
 		wpas_p2p_add_chan(&chan->reg_class[cla], 36);
-	if (!wpas_p2p_disallowed_freq(wpa_s->global, 5000 + 40 * 5))
+	if (!wpas_p2p_disallowed_freq(wpa_s->global, KHZ(5000 + 40 * 5)))
 		wpas_p2p_add_chan(&chan->reg_class[cla], 40);
-	if (!wpas_p2p_disallowed_freq(wpa_s->global, 5000 + 44 * 5))
+	if (!wpas_p2p_disallowed_freq(wpa_s->global, KHZ(5000 + 44 * 5)))
 		wpas_p2p_add_chan(&chan->reg_class[cla], 44);
-	if (!wpas_p2p_disallowed_freq(wpa_s->global, 5000 + 48 * 5))
+	if (!wpas_p2p_disallowed_freq(wpa_s->global, KHZ(5000 + 48 * 5)))
 		wpas_p2p_add_chan(&chan->reg_class[cla], 48);
 	if (chan->reg_class[cla].channels)
 		cla++;
@@ -3484,13 +3487,13 @@ static int wpas_p2p_default_channels(struct wpa_supplicant *wpa_s,
 	/* Operating class 124 - 5 GHz, channels 149,153,157,161 */
 	chan->reg_class[cla].reg_class = 124;
 	chan->reg_class[cla].channels = 0;
-	if (!wpas_p2p_disallowed_freq(wpa_s->global, 5000 + 149 * 5))
+	if (!wpas_p2p_disallowed_freq(wpa_s->global, KHZ(5000 + 149 * 5)))
 		wpas_p2p_add_chan(&chan->reg_class[cla], 149);
-	if (!wpas_p2p_disallowed_freq(wpa_s->global, 5000 + 153 * 5))
+	if (!wpas_p2p_disallowed_freq(wpa_s->global, KHZ(5000 + 153 * 5)))
 		wpas_p2p_add_chan(&chan->reg_class[cla], 153);
-	if (!wpas_p2p_disallowed_freq(wpa_s->global, 5000 + 156 * 5))
+	if (!wpas_p2p_disallowed_freq(wpa_s->global, KHZ(5000 + 156 * 5)))
 		wpas_p2p_add_chan(&chan->reg_class[cla], 157);
-	if (!wpas_p2p_disallowed_freq(wpa_s->global, 5000 + 161 * 5))
+	if (!wpas_p2p_disallowed_freq(wpa_s->global, KHZ(5000 + 161 * 5)))
 		wpas_p2p_add_chan(&chan->reg_class[cla], 161);
 	if (chan->reg_class[cla].channels)
 		cla++;
@@ -3506,8 +3509,8 @@ static int has_channel(struct wpa_global *global,
 	int i;
 	unsigned int freq;
 
-	freq = (mode->mode == HOSTAPD_MODE_IEEE80211A ? 5000 : 2407) +
-		chan * 5;
+	freq = KHZ((mode->mode == HOSTAPD_MODE_IEEE80211A ? 5000 : 2407) +
+		   chan * 5);
 	if (wpas_p2p_disallowed_freq(global, freq))
 		return NOT_ALLOWED;
 
@@ -5017,11 +5020,11 @@ static void wpas_p2p_scan_res_join(struct wpa_supplicant *wpa_s,
 			if (bss) {
 				freq = bss->freq;
 				wpa_printf(MSG_DEBUG, "P2P: Scan retry %d for "
-					   "the peer " MACSTR " at %d MHz",
+					   "the peer " MACSTR " at %g MHz",
 					   wpa_s->auto_pd_scan_retry,
 					   MAC2STR(wpa_s->
 						   pending_join_dev_addr),
-					   freq);
+					   PR_KHZ(freq));
 				wpas_p2p_join_scan_req(wpa_s, freq, NULL, 0);
 				return;
 			}
@@ -5104,7 +5107,7 @@ static void wpas_p2p_scan_res_join(struct wpa_supplicant *wpa_s,
 	}
 	if (freq >= 0) {
 		wpa_printf(MSG_DEBUG, "P2P: Target GO operating frequency "
-			   "from P2P peer table: %d MHz", freq);
+			   "from P2P peer table: %g MHz", PR_KHZ(freq));
 	}
 	if (wpa_s->p2p_join_ssid_len) {
 		wpa_printf(MSG_DEBUG, "P2P: Trying to find target GO BSS entry based on BSSID "
@@ -5126,7 +5129,7 @@ static void wpas_p2p_scan_res_join(struct wpa_supplicant *wpa_s,
 
 		freq = bss->freq;
 		wpa_printf(MSG_DEBUG, "P2P: Target GO operating frequency "
-			   "from BSS table: %d MHz (SSID %s)", freq,
+			   "from BSS table: %g MHz (SSID %s)", PR_KHZ(freq),
 			   wpa_ssid_txt(bss->ssid, bss->ssid_len));
 		if (p2p_parse_dev_addr((const u8 *) (bss + 1), bss->ie_len,
 				       dev_addr) == 0 &&
@@ -5156,8 +5159,8 @@ static void wpas_p2p_scan_res_join(struct wpa_supplicant *wpa_s,
 
 		wpa_printf(MSG_DEBUG, "P2P: Send Provision Discovery Request "
 			   "prior to joining an existing group (GO " MACSTR
-			   " freq=%u MHz)",
-			   MAC2STR(wpa_s->pending_join_dev_addr), freq);
+			   " freq=%g MHz)",
+			   MAC2STR(wpa_s->pending_join_dev_addr), PR_KHZ(freq));
 		wpa_s->pending_pd_before_join = 1;
 
 		switch (wpa_s->pending_join_wps_method) {
@@ -5329,8 +5332,8 @@ static int wpas_p2p_join(struct wpa_supplicant *wpa_s, const u8 *iface_addr,
 			 const u8 *ssid, size_t ssid_len)
 {
 	wpa_printf(MSG_DEBUG, "P2P: Request to join existing group (iface "
-		   MACSTR " dev " MACSTR " op_freq=%d)%s",
-		   MAC2STR(iface_addr), MAC2STR(dev_addr), op_freq,
+		   MACSTR " dev " MACSTR " op_freq=%g)%s",
+		   MAC2STR(iface_addr), MAC2STR(dev_addr), PR_KHZ(op_freq),
 		   auto_join ? " (auto_join)" : "");
 	if (ssid && ssid_len) {
 		wpa_printf(MSG_DEBUG, "P2P: Group SSID specified: %s",
@@ -5463,8 +5466,9 @@ static int wpas_p2p_setup_freqs(struct wpa_supplicant *wpa_s, int freq,
 	num_unused = wpas_p2p_num_unused_channels(wpa_s);
 
 	wpa_printf(MSG_DEBUG,
-		   "P2P: Setup freqs: freq=%d num_MCC=%d shared_freqs=%u num_unused=%d",
-		   freq, wpa_s->num_multichan_concurrent, num, num_unused);
+		   "P2P: Setup freqs: freq=%g num_MCC=%d shared_freqs=%u num_unused=%d",
+		   PR_KHZ(freq), wpa_s->num_multichan_concurrent, num,
+		   num_unused);
 
 	if (freq > 0) {
 		int ret;
@@ -5519,8 +5523,8 @@ static int wpas_p2p_setup_freqs(struct wpa_supplicant *wpa_s, int freq,
 		else
 			iface_type = WPA_IF_P2P_CLIENT;
 
-		wpa_printf(MSG_DEBUG, "P2P: best_freq=%d, go=%d",
-			   best_freq, go);
+		wpa_printf(MSG_DEBUG, "P2P: best_freq=%g, go=%d",
+			   PR_KHZ(best_freq), go);
 
 		res = wpa_drv_get_pref_freq_list(wpa_s, iface_type,
 						 &max_pref_freq,
@@ -5779,18 +5783,20 @@ void wpas_p2p_remain_on_channel_cb(struct wpa_supplicant *wpa_s,
 {
 	if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
 		return;
-	wpa_printf(MSG_DEBUG, "P2P: remain-on-channel callback (off_channel_freq=%u pending_listen_freq=%d roc_waiting_drv_freq=%d freq=%u duration=%u)",
-		   wpa_s->off_channel_freq, wpa_s->pending_listen_freq,
-		   wpa_s->roc_waiting_drv_freq, freq, duration);
+	wpa_printf(MSG_DEBUG, "P2P: remain-on-channel callback (off_channel_freq=%g pending_listen_freq=%g roc_waiting_drv_freq=%g freq=%g duration=%u)",
+		   PR_KHZ(wpa_s->off_channel_freq),
+		   PR_KHZ(wpa_s->pending_listen_freq),
+		   PR_KHZ(wpa_s->roc_waiting_drv_freq), PR_KHZ(freq), duration);
 	if (wpa_s->off_channel_freq &&
 	    wpa_s->off_channel_freq == wpa_s->pending_listen_freq) {
 		p2p_listen_cb(wpa_s->global->p2p, wpa_s->pending_listen_freq,
 			      wpa_s->pending_listen_duration);
 		wpa_s->pending_listen_freq = 0;
 	} else {
-		wpa_printf(MSG_DEBUG, "P2P: Ignore remain-on-channel callback (off_channel_freq=%u pending_listen_freq=%d freq=%u duration=%u)",
-			   wpa_s->off_channel_freq, wpa_s->pending_listen_freq,
-			   freq, duration);
+		wpa_printf(MSG_DEBUG, "P2P: Ignore remain-on-channel callback (off_channel_freq=%g pending_listen_freq=%g freq=%g duration=%u)",
+			   PR_KHZ(wpa_s->off_channel_freq),
+			   PR_KHZ(wpa_s->pending_listen_freq), PR_KHZ(freq),
+			   duration);
 	}
 }
 
@@ -5904,15 +5910,15 @@ static int wpas_p2p_select_go_freq(struct wpa_supplicant *wpa_s, int freq)
 				wpas_p2p_disallowed_freq(wpa_s->global,
 							 pref_freq_list[i]))) {
 				wpa_printf(MSG_DEBUG,
-					   "P2P: preferred_freq_list[%d]=%d is disallowed",
-					   i, pref_freq_list[i]);
+					   "P2P: preferred_freq_list[%d]=%g is disallowed",
+					   i, PR_KHZ(pref_freq_list[i]));
 				i++;
 			}
 			if (i != size) {
 				freq = pref_freq_list[i];
 				wpa_printf(MSG_DEBUG,
-					   "P2P: Using preferred_freq_list[%d]=%d",
-					   i, freq);
+					   "P2P: Using preferred_freq_list[%d]=%g",
+					   i, PR_KHZ(freq));
 			} else {
 				wpa_printf(MSG_DEBUG,
 					   "P2P: All driver preferred frequencies are disallowed for P2P use");
@@ -5931,13 +5937,13 @@ static int wpas_p2p_select_go_freq(struct wpa_supplicant *wpa_s, int freq)
 					  wpa_s->best_24_freq)) {
 			freq = wpa_s->best_24_freq;
 			wpa_printf(MSG_DEBUG, "P2P: Use best 2.4 GHz band "
-				   "channel: %d MHz", freq);
+				   "channel: %g MHz", PR_KHZ(freq));
 		} else {
 			if (os_get_random((u8 *) &r, sizeof(r)) < 0)
 				return -1;
-			freq = 2412 + (r % 3) * 25;
+			freq = KHZ(2412 + (r % 3) * 25);
 			wpa_printf(MSG_DEBUG, "P2P: Use random 2.4 GHz band "
-				   "channel: %d MHz", freq);
+				   "channel: %g MHz", PR_KHZ(freq));
 		}
 	}
 
@@ -5953,14 +5959,14 @@ static int wpas_p2p_select_go_freq(struct wpa_supplicant *wpa_s, int freq)
 		} else {
 			if (os_get_random((u8 *) &r, sizeof(r)) < 0)
 				return -1;
-			freq = 5180 + (r % 4) * 20;
+			freq = KHZ(5180 + (r % 4) * 20);
 			if (!p2p_supported_freq_go(wpa_s->global->p2p, freq)) {
 				wpa_printf(MSG_DEBUG, "P2P: Could not select "
 					   "5 GHz channel for P2P group");
 				return -1;
 			}
 			wpa_printf(MSG_DEBUG, "P2P: Use random 5 GHz band "
-				   "channel: %d MHz", freq);
+				   "channel: %g MHz", PR_KHZ(freq));
 		}
 	}
 
@@ -5973,13 +5979,13 @@ static int wpas_p2p_select_go_freq(struct wpa_supplicant *wpa_s, int freq)
 			 * driver, allow P2P GO to use it.
 			 */
 			wpa_printf(MSG_DEBUG, "P2P: "
-				   "%s: The forced channel for GO (%u MHz) is DFS, and DFS is offloaded",
-				   __func__, freq);
+				   "%s: The forced channel for GO (%g MHz) is DFS, and DFS is offloaded",
+				   __func__, PR_KHZ(freq));
 			return freq;
 		}
 		wpa_printf(MSG_DEBUG, "P2P: The forced channel for GO "
-			   "(%u MHz) is not supported for P2P uses",
-			   freq);
+			   "(%g MHz) is not supported for P2P uses",
+			   PR_KHZ(freq));
 		return -1;
 	}
 
@@ -6007,7 +6013,7 @@ static void wpas_p2p_select_go_freq_no_pref(struct wpa_supplicant *wpa_s,
 
 	/* try all channels in operating class 115 */
 	for (i = 0; i < 4; i++) {
-		params->freq = 5180 + i * 20;
+		params->freq = KHZ(5180 + i * 20);
 		if (!wpas_p2p_disallowed_freq(wpa_s->global, params->freq) &&
 		    freq_included(wpa_s, channels, params->freq) &&
 		    p2p_supported_freq(wpa_s->global->p2p, params->freq))
@@ -6016,7 +6022,7 @@ static void wpas_p2p_select_go_freq_no_pref(struct wpa_supplicant *wpa_s,
 
 	/* try all channels in operating class 124 */
 	for (i = 0; i < 4; i++) {
-		params->freq = 5745 + i * 20;
+		params->freq = KHZ(5745 + i * 20);
 		if (!wpas_p2p_disallowed_freq(wpa_s->global, params->freq) &&
 		    freq_included(wpa_s, channels, params->freq) &&
 		    p2p_supported_freq(wpa_s->global->p2p, params->freq))
@@ -6024,7 +6030,7 @@ static void wpas_p2p_select_go_freq_no_pref(struct wpa_supplicant *wpa_s,
 	}
 
 	/* try social channel class 180 channel 2 */
-	params->freq = 58320 + 1 * 2160;
+	params->freq = KHZ(58320 + 1 * 2160);
 	if (!wpas_p2p_disallowed_freq(wpa_s->global, params->freq) &&
 	    freq_included(wpa_s, channels, params->freq) &&
 	    p2p_supported_freq(wpa_s->global->p2p, params->freq))
@@ -6032,7 +6038,7 @@ static void wpas_p2p_select_go_freq_no_pref(struct wpa_supplicant *wpa_s,
 
 	/* try all channels in reg. class 180 */
 	for (i = 0; i < 4; i++) {
-		params->freq = 58320 + i * 2160;
+		params->freq = KHZ(58320 + i * 2160);
 		if (!wpas_p2p_disallowed_freq(wpa_s->global, params->freq) &&
 		    freq_included(wpa_s, channels, params->freq) &&
 		    p2p_supported_freq(wpa_s->global->p2p, params->freq))
@@ -6044,19 +6050,19 @@ static void wpas_p2p_select_go_freq_no_pref(struct wpa_supplicant *wpa_s,
 		return;
 
 	for (i = 0; i < 3; i++) {
-		params->freq = 2412 + ((r + i) % 3) * 25;
+		params->freq = KHZ(2412 + ((r + i) % 3) * 25);
 		if (wpas_p2p_supported_freq_go(wpa_s, channels, params->freq))
 			goto out;
 	}
 
 	/* try all other channels in operating class 81 */
 	for (i = 0; i < 11; i++) {
-		params->freq = 2412 + i * 5;
+		params->freq = KHZ(2412 + i * 5);
 
 		/* skip social channels; covered in the previous loop */
-		if (params->freq == 2412 ||
-		    params->freq == 2437 ||
-		    params->freq == 2462)
+		if (params->freq == KHZ(2412) ||
+		    params->freq == KHZ(2437) ||
+		    params->freq == KHZ(2462))
 			continue;
 
 		if (wpas_p2p_supported_freq_go(wpa_s, channels, params->freq))
@@ -6232,10 +6238,10 @@ static int wpas_p2p_init_go_params(struct wpa_supplicant *wpa_s,
 	    wpa_s->conf->p2p_oper_channel <= 11 &&
 	    wpas_p2p_supported_freq_go(
 		    wpa_s, channels,
-		    2407 + 5 * wpa_s->conf->p2p_oper_channel)) {
-		params->freq = 2407 + 5 * wpa_s->conf->p2p_oper_channel;
+		    KHZ(2407 + 5 * wpa_s->conf->p2p_oper_channel))) {
+		params->freq = KHZ(2407 + 5 * wpa_s->conf->p2p_oper_channel);
 		wpa_printf(MSG_DEBUG, "P2P: Set GO freq based on configured "
-			   "frequency %d MHz", params->freq);
+			   "frequency %g MHz", PR_KHZ(params->freq));
 		goto success;
 	}
 
@@ -6247,11 +6253,11 @@ static int wpas_p2p_init_go_params(struct wpa_supplicant *wpa_s,
 	     wpa_s->conf->p2p_oper_reg_class == 126 ||
 	     wpa_s->conf->p2p_oper_reg_class == 127) &&
 	    wpas_p2p_supported_freq_go(wpa_s, channels,
-				       5000 +
-				       5 * wpa_s->conf->p2p_oper_channel)) {
-		params->freq = 5000 + 5 * wpa_s->conf->p2p_oper_channel;
+				       KHZ(5000 +
+					   5 * wpa_s->conf->p2p_oper_channel))) {
+		params->freq = KHZ(5000 + 5 * wpa_s->conf->p2p_oper_channel);
 		wpa_printf(MSG_DEBUG, "P2P: Set GO freq based on configured "
-			   "frequency %d MHz", params->freq);
+			   "frequency %g MHz", PR_KHZ(params->freq));
 		goto success;
 	}
 
@@ -6262,7 +6268,7 @@ static int wpas_p2p_init_go_params(struct wpa_supplicant *wpa_s,
 				       wpa_s->best_overall_freq)) {
 		params->freq = wpa_s->best_overall_freq;
 		wpa_printf(MSG_DEBUG, "P2P: Set GO freq based on best overall "
-			   "channel %d MHz", params->freq);
+			   "channel %g MHz", PR_KHZ(params->freq));
 		goto success;
 	}
 
@@ -6272,7 +6278,7 @@ static int wpas_p2p_init_go_params(struct wpa_supplicant *wpa_s,
 				       wpa_s->best_24_freq)) {
 		params->freq = wpa_s->best_24_freq;
 		wpa_printf(MSG_DEBUG, "P2P: Set GO freq based on best 2.4 GHz "
-			   "channel %d MHz", params->freq);
+			   "channel %g MHz", PR_KHZ(params->freq));
 		goto success;
 	}
 
@@ -6282,7 +6288,7 @@ static int wpas_p2p_init_go_params(struct wpa_supplicant *wpa_s,
 				       wpa_s->best_5_freq)) {
 		params->freq = wpa_s->best_5_freq;
 		wpa_printf(MSG_DEBUG, "P2P: Set GO freq based on best 5 GHz "
-			   "channel %d MHz", params->freq);
+			   "channel %g MHz", PR_KHZ(params->freq));
 		goto success;
 	}
 
@@ -6290,8 +6296,8 @@ static int wpas_p2p_init_go_params(struct wpa_supplicant *wpa_s,
 	cand = p2p_get_pref_freq(wpa_s->global->p2p, channels);
 	if (cand && wpas_p2p_supported_freq_go(wpa_s, channels, cand)) {
 		params->freq = cand;
-		wpa_printf(MSG_DEBUG, "P2P: Set GO freq %d MHz from preferred "
-			   "channels", params->freq);
+		wpa_printf(MSG_DEBUG, "P2P: Set GO freq %g MHz from preferred "
+			   "channels", PR_KHZ(params->freq));
 		goto success;
 	}
 
@@ -6313,8 +6319,8 @@ static int wpas_p2p_init_go_params(struct wpa_supplicant *wpa_s,
 			if (wpas_p2p_supported_freq_go(wpa_s, channels, cand)) {
 				params->freq = cand;
 				wpa_printf(MSG_DEBUG,
-					   "P2P: Use freq %d MHz common with the peer and allowing VHT80",
-					   params->freq);
+					   "P2P: Use freq %g MHz common with the peer and allowing VHT80",
+					   PR_KHZ(params->freq));
 				goto success;
 			}
 		}
@@ -6344,8 +6350,8 @@ static int wpas_p2p_init_go_params(struct wpa_supplicant *wpa_s,
 			if (wpas_p2p_supported_freq_go(wpa_s, channels, cand)) {
 				params->freq = cand;
 				wpa_printf(MSG_DEBUG,
-					   "P2P: Use freq %d MHz common with the peer, allowing HT40, and maintaining same band",
-					   params->freq);
+					   "P2P: Use freq %g MHz common with the peer, allowing HT40, and maintaining same band",
+					   PR_KHZ(params->freq));
 				goto success;
 			}
 		}
@@ -6362,8 +6368,8 @@ static int wpas_p2p_init_go_params(struct wpa_supplicant *wpa_s,
 			if (wpas_p2p_supported_freq_go(wpa_s, channels, cand)) {
 				params->freq = cand;
 				wpa_printf(MSG_DEBUG,
-					   "P2P: Use freq %d MHz common with the peer and maintaining same band",
-					   params->freq);
+					   "P2P: Use freq %g MHz common with the peer and maintaining same band",
+					   PR_KHZ(params->freq));
 				goto success;
 			}
 		}
@@ -6376,8 +6382,8 @@ static int wpas_p2p_init_go_params(struct wpa_supplicant *wpa_s,
 			if (wpas_p2p_supported_freq_go(wpa_s, channels, cand)) {
 				params->freq = cand;
 				wpa_printf(MSG_DEBUG,
-					   "P2P: Use freq %d MHz common with the peer",
-					   params->freq);
+					   "P2P: Use freq %g MHz common with the peer",
+					   PR_KHZ(params->freq));
 				goto success;
 			}
 		}
@@ -7340,6 +7346,7 @@ int wpas_p2p_invite_group(struct wpa_supplicant *wpa_s, const char *ifname,
 			go_dev_addr = wpa_s->go_dev_addr;
 		freq = wpa_s->current_bss ? wpa_s->current_bss->freq :
 			(int) wpa_s->assoc_freq;
+		freq = freq;
 	}
 	wpa_s->p2pdev->pending_invite_ssid_id = -1;
 
@@ -7400,6 +7407,7 @@ void wpas_p2p_completed(struct wpa_supplicant *wpa_s)
 
 	freq = wpa_s->current_bss ? wpa_s->current_bss->freq :
 		(int) wpa_s->assoc_freq;
+	freq = freq;
 
 	ip_addr[0] = '\0';
 	if (wpa_sm_get_p2p_ip_addr(wpa_s->wpa, ip) == 0) {
@@ -8764,8 +8772,8 @@ static int wpas_p2p_nfc_join_group(struct wpa_supplicant *wpa_s,
 				   struct p2p_nfc_params *params)
 {
 	wpa_printf(MSG_DEBUG, "P2P: Initiate join-group based on NFC "
-		   "connection handover (freq=%d)",
-		   params->go_freq);
+		   "connection handover (freq=%g)",
+		   PR_KHZ(params->go_freq));
 
 	if (params->go_freq && params->go_ssid_len) {
 		wpa_s->p2p_wps_method = WPS_NFC;
@@ -8969,18 +8977,18 @@ static int wpas_p2p_nfc_connection_handover(struct wpa_supplicant *wpa_s,
 	if (params.next_step == PEER_CLIENT) {
 		if (!is_zero_ether_addr(params.go_dev_addr)) {
 			wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_NFC_PEER_CLIENT
-				"peer=" MACSTR " freq=%d go_dev_addr=" MACSTR
+				"peer=" MACSTR " freq=%g go_dev_addr=" MACSTR
 				" ssid=\"%s\"",
 				MAC2STR(params.peer->p2p_device_addr),
-				params.go_freq,
+				PR_KHZ(params.go_freq),
 				MAC2STR(params.go_dev_addr),
 				wpa_ssid_txt(params.go_ssid,
 					     params.go_ssid_len));
 		} else {
 			wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_NFC_PEER_CLIENT
-				"peer=" MACSTR " freq=%d",
+				"peer=" MACSTR " freq=%g",
 				MAC2STR(params.peer->p2p_device_addr),
-				params.go_freq);
+				PR_KHZ(params.go_freq));
 		}
 		return 0;
 	}
@@ -9369,8 +9377,8 @@ static void wpas_p2p_move_go_no_csa(struct wpa_supplicant *wpa_s)
 
 	wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_REMOVE_AND_REFORM_GROUP);
 
-	wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Move GO from freq=%d MHz",
-		current_ssid->frequency);
+	wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Move GO from freq=%g MHz",
+		PR_KHZ(current_ssid->frequency));
 
 	/* Stop the AP functionality */
 	/* TODO: Should do this in a way that does not indicated to possible
@@ -9485,8 +9493,8 @@ static void wpas_p2p_consider_moving_one_go(struct wpa_supplicant *wpa_s,
 			if (!p2p_supported_freq_go(wpa_s->global->p2p, freq) &&
 			    !dfs_offload) {
 				wpa_dbg(wpa_s, MSG_DEBUG,
-					"P2P: Freq=%d MHz no longer valid for GO",
-					freq);
+					"P2P: Freq=%g MHz no longer valid for GO",
+					PR_KHZ(freq));
 				invalid_freq = 1;
 			}
 		} else if (freqs[i].flags == 0) {
@@ -9526,7 +9534,7 @@ static void wpas_p2p_consider_moving_one_go(struct wpa_supplicant *wpa_s,
 	}
 
 	wpa_dbg(wpa_s, MSG_DEBUG,
-		"P2P: GO move: invalid_freq=%u, policy_move=%u, flags=0x%X",
+		"P2P: GO move: invalid_freq=%d, policy_move=%u, flags=0x%X",
 		invalid_freq, policy_move, flags);
 
 	/*
@@ -9535,7 +9543,7 @@ static void wpas_p2p_consider_moving_one_go(struct wpa_supplicant *wpa_s,
 	 */
 	if (!invalid_freq || policy_move) {
 		wpa_dbg(wpa_s, MSG_DEBUG,
-			"P2P: Cancel a GO move from freq=%d MHz", freq);
+			"P2P: Cancel a GO move from freq=%g MHz", PR_KHZ(freq));
 		eloop_cancel_timeout(wpas_p2p_move_go, wpa_s, NULL);
 
 		if (wpas_p2p_in_progress(wpa_s)) {
@@ -9571,8 +9579,8 @@ static void wpas_p2p_consider_moving_one_go(struct wpa_supplicant *wpa_s,
 	else
 		timeout = 0;
 
-	wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Move GO from freq=%d MHz in %d secs",
-		freq, timeout);
+	wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Move GO from freq=%g MHz in %d secs",
+		PR_KHZ(freq), timeout);
 	eloop_cancel_timeout(wpas_p2p_move_go, wpa_s, NULL);
 	eloop_register_timeout(timeout, 0, wpas_p2p_move_go, wpa_s, NULL);
 }
diff --git a/wpa_supplicant/rrm.c b/wpa_supplicant/rrm.c
index afc117275724..3eb46c488626 100644
--- a/wpa_supplicant/rrm.c
+++ b/wpa_supplicant/rrm.c
@@ -487,7 +487,7 @@ static int wpas_add_channel(u8 op_class, u8 chan, u8 num_primary_channels,
 		 * channels, so handle those as special cases here for now. */
 		if (freqs[i] < 0 &&
 		    (op_class == 128 || op_class == 129 || op_class == 130))
-			freqs[i] = 5000 + 5 * primary_chan;
+			freqs[i] = KHZ(5000 + 5 * primary_chan);
 		if (freqs[i] < 0) {
 			wpa_printf(MSG_DEBUG,
 				   "Beacon Report: Invalid channel %u",
@@ -745,8 +745,9 @@ int wpas_get_op_chan_phy(int freq, const u8 *ies, size_t ies_len,
 		}
 	}
 
-	if (ieee80211_freq_to_channel_ext(freq, sec_chan, vht, op_class,
-					  chan) == NUM_HOSTAPD_MODES) {
+	if (ieee80211_freq_to_channel_ext(freq, sec_chan, vht,
+					  op_class, chan) == NUM_HOSTAPD_MODES)
+	{
 		wpa_printf(MSG_DEBUG,
 			   "Cannot determine operating class and channel");
 		return -1;
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index b47573094126..2cd9dae19a00 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -398,8 +398,8 @@ static void wpa_supplicant_optimize_freqs(
 		if (wpa_s->p2p_in_provisioning < 5 &&
 		    wpa_s->go_params->freq > 0) {
 			wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Scan only GO "
-				"preferred frequency %d MHz",
-				wpa_s->go_params->freq);
+				"preferred frequency %g MHz",
+				PR_KHZ(wpa_s->go_params->freq));
 			params->freqs = os_calloc(2, sizeof(int));
 			if (params->freqs)
 				params->freqs[0] = wpa_s->go_params->freq;
@@ -422,8 +422,8 @@ static void wpa_supplicant_optimize_freqs(
 		 */
 		if (wpa_s->p2p_in_invitation < 5 &&
 		    wpa_s->p2p_invite_go_freq > 0) {
-			wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Scan only GO preferred frequency %d MHz during invitation",
-				wpa_s->p2p_invite_go_freq);
+			wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Scan only GO preferred frequency %g MHz during invitation",
+				PR_KHZ(wpa_s->p2p_invite_go_freq));
 			params->freqs = os_calloc(2, sizeof(int));
 			if (params->freqs)
 				params->freqs[0] = wpa_s->p2p_invite_go_freq;
@@ -448,8 +448,9 @@ static void wpa_supplicant_optimize_freqs(
 		 * Optimize post-provisioning scan based on channel used
 		 * during provisioning.
 		 */
-		wpa_dbg(wpa_s, MSG_DEBUG, "WPS: Scan only frequency %u MHz "
-			"that was used during provisioning", wpa_s->wps_freq);
+		wpa_dbg(wpa_s, MSG_DEBUG, "WPS: Scan only frequency %g MHz "
+			"that was used during provisioning",
+			PR_KHZ(wpa_s->wps_freq));
 		params->freqs = os_calloc(2, sizeof(int));
 		if (params->freqs)
 			params->freqs[0] = wpa_s->wps_freq;
@@ -460,8 +461,8 @@ static void wpa_supplicant_optimize_freqs(
 	if (params->freqs == NULL && wpa_s->known_wps_freq && wpa_s->wps_freq)
 	{
 		/* Optimize provisioning scan based on already known channel */
-		wpa_dbg(wpa_s, MSG_DEBUG, "WPS: Scan only frequency %u MHz",
-			wpa_s->wps_freq);
+		wpa_dbg(wpa_s, MSG_DEBUG, "WPS: Scan only frequency %g MHz",
+			PR_KHZ(wpa_s->wps_freq));
 		params->freqs = os_calloc(2, sizeof(int));
 		if (params->freqs)
 			params->freqs[0] = wpa_s->wps_freq;
@@ -2090,17 +2091,17 @@ static void dump_scan_res(struct wpa_scan_results *scan_res)
 		if (r->flags & WPA_SCAN_LEVEL_DBM) {
 			int noise_valid = !(r->flags & WPA_SCAN_NOISE_INVALID);
 
-			wpa_printf(MSG_EXCESSIVE, MACSTR " freq=%d qual=%d "
+			wpa_printf(MSG_EXCESSIVE, MACSTR " freq=%g qual=%d "
 				   "noise=%d%s level=%d snr=%d%s flags=0x%x age=%u est=%u",
-				   MAC2STR(r->bssid), r->freq, r->qual,
+				   MAC2STR(r->bssid), PR_KHZ(r->freq), r->qual,
 				   r->noise, noise_valid ? "" : "~", r->level,
 				   r->snr, r->snr >= GREAT_SNR ? "*" : "",
 				   r->flags,
 				   r->age, r->est_throughput);
 		} else {
-			wpa_printf(MSG_EXCESSIVE, MACSTR " freq=%d qual=%d "
+			wpa_printf(MSG_EXCESSIVE, MACSTR " freq=%g qual=%d "
 				   "noise=%d level=%d flags=0x%x age=%u est=%u",
-				   MAC2STR(r->bssid), r->freq, r->qual,
+				   MAC2STR(r->bssid), PR_KHZ(r->freq), r->qual,
 				   r->noise, r->level, r->flags, r->age,
 				   r->est_throughput);
 		}
diff --git a/wpa_supplicant/scan.h b/wpa_supplicant/scan.h
index c9ce2cecf8ae..f15a481e5072 100644
--- a/wpa_supplicant/scan.h
+++ b/wpa_supplicant/scan.h
@@ -29,7 +29,7 @@
  */
 #define GREAT_SNR 25
 
-#define IS_5GHZ(n) (n > 4000)
+#define IS_5GHZ(n) (n > KHZ(4000))
 
 int wpa_supplicant_enabled_networks(struct wpa_supplicant *wpa_s);
 void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec);
diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
index f45bab27ab59..c56057e527c8 100644
--- a/wpa_supplicant/sme.c
+++ b/wpa_supplicant/sme.c
@@ -862,8 +862,9 @@ no_fils:
 	wpa_supplicant_cancel_scan(wpa_s);
 
 	wpa_msg(wpa_s, MSG_INFO, "SME: Trying to authenticate with " MACSTR
-		" (SSID='%s' freq=%d MHz)", MAC2STR(params.bssid),
-		wpa_ssid_txt(params.ssid, params.ssid_len), params.freq);
+		" (SSID='%s' freq=%g MHz)", MAC2STR(params.bssid),
+		wpa_ssid_txt(params.ssid, params.ssid_len),
+		PR_KHZ(params.freq));
 
 	eapol_sm_notify_portValid(wpa_s->eapol, false);
 	wpa_clear_keys(wpa_s, bss->bssid);
@@ -886,8 +887,8 @@ no_fils:
 		num = get_shared_radio_freqs(wpa_s, &freq, 1);
 		if (num > 0 && freq > 0 && freq != params.freq) {
 			wpa_printf(MSG_DEBUG,
-				   "Conflicting frequency found (%d != %d)",
-				   freq, params.freq);
+				   "Conflicting frequency found (%g != %g)",
+				   PR_KHZ(freq), PR_KHZ(params.freq));
 			if (wpas_p2p_handle_frequency_conflicts(wpa_s,
 								params.freq,
 								ssid) < 0) {
@@ -2014,9 +2015,9 @@ pfs_fail:
 		params.prev_bssid = wpa_s->sme.prev_bssid;
 
 	wpa_msg(wpa_s, MSG_INFO, "Trying to associate with " MACSTR
-		" (SSID='%s' freq=%d MHz)", MAC2STR(params.bssid),
+		" (SSID='%s' freq=%g MHz)", MAC2STR(params.bssid),
 		params.ssid ? wpa_ssid_txt(params.ssid, params.ssid_len) : "",
-		params.freq.freq);
+		PR_KHZ(params.freq.freq));
 
 	wpa_supplicant_set_state(wpa_s, WPA_ASSOCIATING);
 
@@ -2369,10 +2370,10 @@ int sme_proc_obss_scan(struct wpa_supplicant *wpa_s,
 
 	switch (wpa_s->sme.ht_sec_chan) {
 	case HT_SEC_CHAN_ABOVE:
-		sec_freq = pri_freq + 20;
+		sec_freq = pri_freq + KHZ(20);
 		break;
 	case HT_SEC_CHAN_BELOW:
-		sec_freq = pri_freq - 20;
+		sec_freq = pri_freq - KHZ(20);
 		break;
 	case HT_SEC_CHAN_UNKNOWN:
 	default:
@@ -2446,27 +2447,27 @@ static void wpa_obss_scan_freqs_list(struct wpa_supplicant *wpa_s,
 		}
 	}
 
-	start = wpa_s->assoc_freq - 10;
-	end = wpa_s->assoc_freq + 10;
+	start = wpa_s->assoc_freq - KHZ(10);
+	end = wpa_s->assoc_freq + KHZ(10);
 	switch (wpa_s->sme.ht_sec_chan) {
 	case HT_SEC_CHAN_UNKNOWN:
 		/* HT40+ possible on channels 1..9 */
-		if (wpa_s->assoc_freq <= 2452)
-			start -= 20;
+		if (wpa_s->assoc_freq <= KHZ(2452))
+			start -= KHZ(20);
 		/* HT40- possible on channels 5-13 */
-		if (wpa_s->assoc_freq >= 2432)
-			end += 20;
+		if (wpa_s->assoc_freq >= KHZ(2432))
+			end += KHZ(20);
 		break;
 	case HT_SEC_CHAN_ABOVE:
-		end += 20;
+		end += KHZ(20);
 		break;
 	case HT_SEC_CHAN_BELOW:
-		start -= 20;
+		start -= KHZ(20);
 		break;
 	}
 	wpa_printf(MSG_DEBUG,
-		   "OBSS: assoc_freq %d possible affected range %d-%d",
-		   wpa_s->assoc_freq, start, end);
+		   "OBSS: assoc_freq %g possible affected range %g-%g",
+		   PR_KHZ(wpa_s->assoc_freq), PR_KHZ(start), PR_KHZ(end));
 
 	params->freqs = os_calloc(mode->num_channels + 1, sizeof(int));
 	if (params->freqs == NULL)
@@ -2477,7 +2478,8 @@ static void wpa_obss_scan_freqs_list(struct wpa_supplicant *wpa_s,
 		if (mode->channels[i].flag & HOSTAPD_CHAN_DISABLED)
 			continue;
 		freq = mode->channels[i].freq;
-		if (freq - 10 >= end || freq + 10 <= start)
+		if (freq - KHZ(10) >= end ||
+		    freq + KHZ(10) <= start)
 			continue; /* not affected */
 		params->freqs[count++] = freq;
 	}
@@ -2548,7 +2550,8 @@ void sme_sched_obss_scan(struct wpa_supplicant *wpa_s, int enable)
 	    !(hw_mode->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET))
 		return;
 
-	if (bss == NULL || bss->freq < 2400 || bss->freq > 2500)
+	if (bss == NULL || bss->freq < KHZ(2400) ||
+	    bss->freq > KHZ(2500))
 		return; /* Not associated on 2.4 GHz band */
 
 	/* Check whether AP supports HT40 */
@@ -2626,9 +2629,9 @@ static void sme_send_sa_query_req(struct wpa_supplicant *wpa_s,
 #ifdef CONFIG_TESTING_OPTIONS
 		if (wpa_s->oci_freq_override_saquery_req) {
 			wpa_printf(MSG_INFO,
-				   "TEST: Override SA Query Request OCI frequency %d -> %d MHz",
-				   ci.frequency,
-				   wpa_s->oci_freq_override_saquery_req);
+				   "TEST: Override SA Query Request OCI frequency %g -> %g MHz",
+				   PR_KHZ(ci.frequency),
+				   PR_KHZ(wpa_s->oci_freq_override_saquery_req));
 			ci.frequency = wpa_s->oci_freq_override_saquery_req;
 		}
 #endif /* CONFIG_TESTING_OPTIONS */
@@ -2790,9 +2793,9 @@ static void sme_process_sa_query_request(struct wpa_supplicant *wpa_s,
 #ifdef CONFIG_TESTING_OPTIONS
 		if (wpa_s->oci_freq_override_saquery_resp) {
 			wpa_printf(MSG_INFO,
-				   "TEST: Override SA Query Response OCI frequency %d -> %d MHz",
-				   ci.frequency,
-				   wpa_s->oci_freq_override_saquery_resp);
+				   "TEST: Override SA Query Response OCI frequency %g -> %g MHz",
+				   PR_KHZ(ci.frequency),
+				   PR_KHZ(wpa_s->oci_freq_override_saquery_resp));
 			ci.frequency = wpa_s->oci_freq_override_saquery_resp;
 		}
 #endif /* CONFIG_TESTING_OPTIONS */
diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c
index 411ce886d353..0a02fead933b 100644
--- a/wpa_supplicant/wnm_sta.c
+++ b/wpa_supplicant/wnm_sta.c
@@ -540,11 +540,11 @@ static int wnm_nei_get_chan(struct wpa_supplicant *wpa_s, u8 op_class, u8 chan)
 		 * frequency based on the channel number.
 		 */
 		if (chan >= 1 && chan <= 13)
-			freq = 2407 + chan * 5;
+			freq = KHZ(2407 + chan * 5);
 		else if (chan == 14)
-			freq = 2484;
+			freq = KHZ(2484);
 		else if (chan >= 36 && chan <= 169)
-			freq = 5000 + chan * 5;
+			freq = KHZ(5000 + chan * 5);
 	}
 	return freq;
 }
@@ -1217,12 +1217,12 @@ static void wnm_dump_cand_list(struct wpa_supplicant *wpa_s)
 
 		nei = &wpa_s->wnm_neighbor_report_elements[i];
 		wpa_printf(MSG_DEBUG, "%u: " MACSTR
-			   " info=0x%x op_class=%u chan=%u phy=%u pref=%d freq=%d",
+			   " info=0x%x op_class=%u chan=%u phy=%u pref=%d freq=%g",
 			   i, MAC2STR(nei->bssid), nei->bssid_info,
 			   nei->regulatory_class,
 			   nei->channel_number, nei->phy_type,
 			   nei->preference_present ? nei->preference : -1,
-			   nei->freq);
+			   PR_KHZ(nei->freq));
 	}
 }
 
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 4c1daf1fab9e..b687bc3ca642 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2608,11 +2608,11 @@ skip_ht40:
 				break;
 		}
 	} else if (ssid->max_oper_chwidth == CHANWIDTH_160MHZ) {
-		if (freq->freq == 5180) {
+		if (freq->freq == KHZ(5180)) {
 			chwidth = CHANWIDTH_160MHZ;
 			vht_caps |= VHT_CAP_SUPP_CHAN_WIDTH_160MHZ;
 			seg0 = 50;
-		} else if (freq->freq == 5520) {
+		} else if (freq->freq == KHZ(5520)) {
 			chwidth = CHANWIDTH_160MHZ;
 			vht_caps |= VHT_CAP_SUPP_CHAN_WIDTH_160MHZ;
 			seg0 = 114;
@@ -2643,8 +2643,9 @@ skip_ht40:
 
 	*freq = vht_freq;
 
-	wpa_printf(MSG_DEBUG, "IBSS: VHT setup freq cf1 %d, cf2 %d, bw %d",
-		   freq->center_freq1, freq->center_freq2, freq->bandwidth);
+	wpa_printf(MSG_DEBUG, "IBSS: VHT setup freq cf1 %g, cf2 %g, bw %d",
+		   PR_KHZ(freq->center_freq1), PR_KHZ(freq->center_freq2),
+		   freq->bandwidth);
 }
 
 
@@ -3444,8 +3445,9 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit)
 		const u8 *ie, *md = NULL;
 #endif /* CONFIG_IEEE80211R */
 		wpa_msg(wpa_s, MSG_INFO, "Trying to associate with " MACSTR
-			" (SSID='%s' freq=%d MHz)", MAC2STR(bss->bssid),
-			wpa_ssid_txt(bss->ssid, bss->ssid_len), bss->freq);
+			" (SSID='%s' freq=%g MHz)", MAC2STR(bss->bssid),
+			wpa_ssid_txt(bss->ssid, bss->ssid_len),
+			PR_KHZ(bss->freq));
 		bssid_changed = !is_zero_ether_addr(wpa_s->bssid);
 		os_memset(wpa_s->bssid, 0, ETH_ALEN);
 		os_memcpy(wpa_s->pending_bssid, bss->bssid, ETH_ALEN);
@@ -3545,9 +3547,9 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit)
 		if (!wpas_driver_bss_selection(wpa_s) || ssid->bssid_set ||
 		    wpa_s->key_mgmt == WPA_KEY_MGMT_WPS) {
 			wpa_printf(MSG_DEBUG, "Limit connection to BSSID "
-				   MACSTR " freq=%u MHz based on scan results "
+				   MACSTR " freq=%g MHz based on scan results "
 				   "(bssid_set=%d wps=%d)",
-				   MAC2STR(bss->bssid), bss->freq,
+				   MAC2STR(bss->bssid), PR_KHZ(bss->freq),
 				   ssid->bssid_set,
 				   wpa_s->key_mgmt == WPA_KEY_MGMT_WPS);
 			params.bssid = bss->bssid;
@@ -5551,9 +5553,9 @@ static int wpas_set_wowlan_triggers(struct wpa_supplicant *wpa_s,
 
 enum wpa_radio_work_band wpas_freq_to_band(int freq)
 {
-	if (freq < 3000)
+	if (freq < KHZ(3000))
 		return BAND_2_4_GHZ;
-	if (freq > 50000)
+	if (freq > KHZ(50000))
 		return BAND_60_GHZ;
 	return BAND_5_GHZ;
 }
@@ -6084,9 +6086,9 @@ static void wpas_gas_server_tx_status(struct wpa_supplicant *wpa_s,
 				      const u8 *data, size_t data_len,
 				      enum offchannel_send_action_result result)
 {
-	wpa_printf(MSG_DEBUG, "GAS: TX status: freq=%u dst=" MACSTR
+	wpa_printf(MSG_DEBUG, "GAS: TX status: freq=%g dst=" MACSTR
 		   " result=%s",
-		   freq, MAC2STR(dst),
+		   PR_KHZ(freq), MAC2STR(dst),
 		   result == OFFCHANNEL_SEND_ACTION_SUCCESS ? "SUCCESS" :
 		   (result == OFFCHANNEL_SEND_ACTION_NO_ACK ? "no-ACK" :
 		    "FAILED"));
@@ -7704,8 +7706,8 @@ void dump_freq_data(struct wpa_supplicant *wpa_s, const char *title,
 		len, title);
 	for (i = 0; i < len; i++) {
 		struct wpa_used_freq_data *cur = &freqs_data[i];
-		wpa_dbg(wpa_s, MSG_DEBUG, "freq[%u]: %d, flags=0x%X",
-			i, cur->freq, cur->flags);
+		wpa_dbg(wpa_s, MSG_DEBUG, "freq[%d]: %g, flags=0x%X",
+			i, PR_KHZ(cur->freq), cur->flags);
 	}
 }
 
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index b7680f0888e2..af6879a7040d 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -120,7 +120,7 @@ int wpas_wps_eapol_cb(struct wpa_supplicant *wpa_s)
 
 		wpa_printf(MSG_DEBUG, "WPS: Network configuration replaced - "
 			   "try to associate with the received credential "
-			   "(freq=%u)", freq);
+			   "(freq=%g)", PR_KHZ(freq));
 		wpa_s->own_disconnect_req = 1;
 		wpa_supplicant_deauthenticate(wpa_s,
 					      WLAN_REASON_DEAUTH_LEAVING);
@@ -922,8 +922,8 @@ static int wpa_supplicant_wps_rf_band(void *ctx)
 	if (!wpa_s->current_ssid || !wpa_s->assoc_freq)
 		return 0;
 
-	return (wpa_s->assoc_freq > 50000) ? WPS_RF_60GHZ :
-		(wpa_s->assoc_freq > 2484) ? WPS_RF_50GHZ : WPS_RF_24GHZ;
+	return (wpa_s->assoc_freq > KHZ(50000)) ? WPS_RF_60GHZ :
+		(wpa_s->assoc_freq > KHZ(2484)) ? WPS_RF_50GHZ : WPS_RF_24GHZ;
 }
 
 
@@ -1179,7 +1179,7 @@ int wpas_wps_start_pbc(struct wpa_supplicant *wpa_s, const u8 *bssid,
 			ssid->ssid_len = wpa_s->go_params->ssid_len;
 			os_memcpy(ssid->ssid, wpa_s->go_params->ssid,
 				  ssid->ssid_len);
-			if (wpa_s->go_params->freq > 56160) {
+			if (wpa_s->go_params->freq > KHZ(56160)) {
 				/* P2P in 60 GHz uses PBSS */
 				ssid->pbss = 1;
 			}
@@ -1267,7 +1267,7 @@ static int wpas_wps_start_dev_pw(struct wpa_supplicant *wpa_s,
 			ssid->ssid_len = wpa_s->go_params->ssid_len;
 			os_memcpy(ssid->ssid, wpa_s->go_params->ssid,
 				  ssid->ssid_len);
-			if (wpa_s->go_params->freq > 56160) {
+			if (wpa_s->go_params->freq > KHZ(56160)) {
 				/* P2P in 60 GHz uses PBSS */
 				ssid->pbss = 1;
 			}
@@ -2438,15 +2438,15 @@ static int wpas_wps_use_cred(struct wpa_supplicant *wpa_s,
 		int freq = 0;
 
 		if (chan >= 1 && chan <= 13)
-			freq = 2407 + 5 * chan;
+			freq = KHZ(2407 + 5 * chan);
 		else if (chan == 14)
-			freq = 2484;
+			freq = KHZ(2484);
 		else if (chan >= 30)
-			freq = 5000 + 5 * chan;
+			freq = KHZ(5000 + 5 * chan);
 
 		if (freq) {
-			wpa_printf(MSG_DEBUG, "WPS: Credential container indicated AP channel %u -> %u MHz",
-				   chan, freq);
+			wpa_printf(MSG_DEBUG, "WPS: Credential container indicated AP channel %u -> %g MHz",
+				   chan, PR_KHZ(freq));
 			wpa_s->after_wps = 5;
 			wpa_s->wps_freq = freq;
 		}
@@ -2717,24 +2717,24 @@ static int wpas_wps_nfc_rx_handover_sel(struct wpa_supplicant *wpa_s,
 
 		if (chan >= 1 && chan <= 13 &&
 		    (attr.rf_bands == NULL || *attr.rf_bands & WPS_RF_24GHZ))
-			freq = 2407 + 5 * chan;
+			freq = KHZ(2407 + 5 * chan);
 		else if (chan == 14 &&
 			 (attr.rf_bands == NULL ||
 			  *attr.rf_bands & WPS_RF_24GHZ))
-			freq = 2484;
+			freq = KHZ(2484);
 		else if (chan >= 30 &&
 			 (attr.rf_bands == NULL ||
 			  *attr.rf_bands & WPS_RF_50GHZ))
-			freq = 5000 + 5 * chan;
+			freq = KHZ(5000 + 5 * chan);
 		else if (chan >= 1 && chan <= 6 &&
 			 (attr.rf_bands == NULL ||
 			  *attr.rf_bands & WPS_RF_60GHZ))
-			freq = 56160 + 2160 * chan;
+			freq = KHZ(56160 + 2160 * chan);
 
 		if (freq) {
 			wpa_printf(MSG_DEBUG,
-				   "WPS: AP indicated channel %u -> %u MHz",
-				   chan, freq);
+				   "WPS: AP indicated channel %u -> %g MHz",
+				   chan, PR_KHZ(freq));
 		}
 	}
 
-- 
2.20.1


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux