All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] wiphy: Add parser and getter for max ie len attr
@ 2019-11-06 22:16 Tim Kourt
  2019-11-06 22:16 ` [PATCH 2/2] wsc: Check capability before adding .SimpleConfiguration interface Tim Kourt
  2019-11-06 23:00 ` [PATCH 1/2] wiphy: Add parser and getter for max ie len attr Denis Kenzior
  0 siblings, 2 replies; 4+ messages in thread
From: Tim Kourt @ 2019-11-06 22:16 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 1937 bytes --]

---
 src/wiphy.c | 12 ++++++++++++
 src/wiphy.h |  1 +
 2 files changed, 13 insertions(+)

diff --git a/src/wiphy.c b/src/wiphy.c
index ef22c0d3..4446abba 100644
--- a/src/wiphy.c
+++ b/src/wiphy.c
@@ -67,6 +67,7 @@ struct wiphy {
 	uint8_t ext_features[(NUM_NL80211_EXT_FEATURES + 7) / 8];
 	uint8_t max_num_ssids_per_scan;
 	uint32_t max_roc_duration;
+	uint16_t max_scan_ie_len;
 	uint16_t supported_iftypes;
 	uint16_t supported_ciphers;
 	struct scan_freq_set *supported_freqs;
@@ -363,6 +364,11 @@ uint8_t wiphy_get_max_num_ssids_per_scan(struct wiphy *wiphy)
 	return wiphy->max_num_ssids_per_scan;
 }
 
+uint16_t wiphy_get_max_scan_ie_len(struct wiphy *wiphy)
+{
+	return wiphy->max_scan_ie_len;
+}
+
 uint32_t wiphy_get_max_roc_duration(struct wiphy *wiphy)
 {
 	return wiphy->max_roc_duration;
@@ -834,6 +840,12 @@ static void wiphy_parse_attributes(struct wiphy *wiphy,
 				wiphy->max_num_ssids_per_scan =
 							*((uint8_t *) data);
 			break;
+		case NL80211_ATTR_MAX_SCAN_IE_LEN:
+			if (len != sizeof(uint16_t))
+				l_warn("Invalid MAX_SCAN_IE_LEN attribute");
+			else
+				wiphy->max_scan_ie_len = *((uint16_t *) data);
+			break;
 		case NL80211_ATTR_SUPPORT_IBSS_RSN:
 			wiphy->support_adhoc_rsn = true;
 			break;
diff --git a/src/wiphy.h b/src/wiphy.h
index 85fa3f56..67eafe3c 100644
--- a/src/wiphy.h
+++ b/src/wiphy.h
@@ -64,6 +64,7 @@ bool wiphy_rrm_capable(struct wiphy *wiphy);
 bool wiphy_has_feature(struct wiphy *wiphy, uint32_t feature);
 bool wiphy_has_ext_feature(struct wiphy *wiphy, uint32_t feature);
 uint8_t wiphy_get_max_num_ssids_per_scan(struct wiphy *wiphy);
+uint16_t wiphy_get_max_scan_ie_len(struct wiphy *wiphy);
 uint32_t wiphy_get_max_roc_duration(struct wiphy *wiphy);
 bool wiphy_supports_iftype(struct wiphy *wiphy, uint32_t iftype);
 const uint8_t *wiphy_get_supported_rates(struct wiphy *wiphy, unsigned int band,
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] wsc: Check capability before adding .SimpleConfiguration interface
  2019-11-06 22:16 [PATCH 1/2] wiphy: Add parser and getter for max ie len attr Tim Kourt
@ 2019-11-06 22:16 ` Tim Kourt
  2019-11-06 23:03   ` Denis Kenzior
  2019-11-06 23:00 ` [PATCH 1/2] wiphy: Add parser and getter for max ie len attr Denis Kenzior
  1 sibling, 1 reply; 4+ messages in thread
From: Tim Kourt @ 2019-11-06 22:16 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 1714 bytes --]

---
 src/wiphy.c | 5 +++++
 src/wiphy.h | 1 +
 src/wsc.c   | 7 +++++++
 3 files changed, 13 insertions(+)

diff --git a/src/wiphy.c b/src/wiphy.c
index 4446abba..e9397187 100644
--- a/src/wiphy.c
+++ b/src/wiphy.c
@@ -369,6 +369,11 @@ uint16_t wiphy_get_max_scan_ie_len(struct wiphy *wiphy)
 	return wiphy->max_scan_ie_len;
 }
 
+bool wiphy_is_scan_ie_supported(struct wiphy *wiphy)
+{
+	return wiphy->max_scan_ie_len ? true : false;
+}
+
 uint32_t wiphy_get_max_roc_duration(struct wiphy *wiphy)
 {
 	return wiphy->max_roc_duration;
diff --git a/src/wiphy.h b/src/wiphy.h
index 67eafe3c..7d378aa0 100644
--- a/src/wiphy.h
+++ b/src/wiphy.h
@@ -65,6 +65,7 @@ bool wiphy_has_feature(struct wiphy *wiphy, uint32_t feature);
 bool wiphy_has_ext_feature(struct wiphy *wiphy, uint32_t feature);
 uint8_t wiphy_get_max_num_ssids_per_scan(struct wiphy *wiphy);
 uint16_t wiphy_get_max_scan_ie_len(struct wiphy *wiphy);
+bool wiphy_is_scan_ie_supported(struct wiphy *wiphy);
 uint32_t wiphy_get_max_roc_duration(struct wiphy *wiphy);
 bool wiphy_supports_iftype(struct wiphy *wiphy, uint32_t iftype);
 const uint8_t *wiphy_get_supported_rates(struct wiphy *wiphy, unsigned int band,
diff --git a/src/wsc.c b/src/wsc.c
index bac6e0cc..ed211834 100644
--- a/src/wsc.c
+++ b/src/wsc.c
@@ -1108,6 +1108,13 @@ static void wsc_add_interface(struct netdev *netdev)
 	struct l_dbus *dbus = dbus_get_bus();
 	struct wsc *wsc;
 
+	if (!wiphy_is_scan_ie_supported(netdev_get_wiphy(netdev))) {
+		l_info("Simple Configuration isn't supported by ifindex %u",
+						netdev_get_ifindex(netdev));
+
+		return;
+	}
+
 	wsc = l_new(struct wsc, 1);
 	wsc->netdev = netdev;
 
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] wiphy: Add parser and getter for max ie len attr
  2019-11-06 22:16 [PATCH 1/2] wiphy: Add parser and getter for max ie len attr Tim Kourt
  2019-11-06 22:16 ` [PATCH 2/2] wsc: Check capability before adding .SimpleConfiguration interface Tim Kourt
@ 2019-11-06 23:00 ` Denis Kenzior
  1 sibling, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2019-11-06 23:00 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 198 bytes --]

Hi Tim,

On 11/6/19 4:16 PM, Tim Kourt wrote:
> ---
>   src/wiphy.c | 12 ++++++++++++
>   src/wiphy.h |  1 +
>   2 files changed, 13 insertions(+)
> 

Applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] wsc: Check capability before adding .SimpleConfiguration interface
  2019-11-06 22:16 ` [PATCH 2/2] wsc: Check capability before adding .SimpleConfiguration interface Tim Kourt
@ 2019-11-06 23:03   ` Denis Kenzior
  0 siblings, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2019-11-06 23:03 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 1003 bytes --]

Hi Tim,

> +bool wiphy_is_scan_ie_supported(struct wiphy *wiphy)
> +{
> +	return wiphy->max_scan_ie_len ? true : false;
> +}
> +

Lets not go overboard adding APIs to wiphy.c now..  You already have 
something that can accomplish the job, so just use that.

<snip>

> diff --git a/src/wsc.c b/src/wsc.c
> index bac6e0cc..ed211834 100644
> --- a/src/wsc.c
> +++ b/src/wsc.c
> @@ -1108,6 +1108,13 @@ static void wsc_add_interface(struct netdev *netdev)
>   	struct l_dbus *dbus = dbus_get_bus();
>   	struct wsc *wsc;
>   
> +	if (!wiphy_is_scan_ie_supported(netdev_get_wiphy(netdev))) {
> +		l_info("Simple Configuration isn't supported by ifindex %u",
> +						netdev_get_ifindex(netdev));
> +
> +		return;
> +	}

I don't like the l_info here.  This will get printed way too many times 
due to ifup/ifdown.  Perhaps we need to add an L_WARN_ONCE or do this 
statically here.

> +
>   	wsc = l_new(struct wsc, 1);
>   	wsc->netdev = netdev;
>   
> 

Regards,
-Denis

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-06 23:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-06 22:16 [PATCH 1/2] wiphy: Add parser and getter for max ie len attr Tim Kourt
2019-11-06 22:16 ` [PATCH 2/2] wsc: Check capability before adding .SimpleConfiguration interface Tim Kourt
2019-11-06 23:03   ` Denis Kenzior
2019-11-06 23:00 ` [PATCH 1/2] wiphy: Add parser and getter for max ie len attr Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.