diff mbox series

station: check support for all sysfs settings

Message ID 20241024131628.152607-1-prestwoj@gmail.com (mailing list archive)
State New
Headers show
Series station: check support for all sysfs settings | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-alpine-ci-fetch success Fetch PR
prestwoj/iwd-ci-gitlint fail station: check support for all sysfs settings 8: B1 Line exceeds max length (88>80): "Unable to write drop_unsolicited_na to /proc/sys/net/ipv6/conf/wlan0/drop_unsolicited_na"
prestwoj/iwd-ci-fetch success Fetch PR
prestwoj/iwd-alpine-ci-setupell success Prep - Setup ELL
prestwoj/iwd-ci-setupell success Prep - Setup ELL
prestwoj/iwd-ci-incremental_build success Incremental build not run PASS
prestwoj/iwd-alpine-ci-makedistcheck success Make Distcheck
prestwoj/iwd-alpine-ci-incremental_build success Incremental build not run PASS
prestwoj/iwd-ci-build success Build - Configure
prestwoj/iwd-alpine-ci-build success Build - Configure
prestwoj/iwd-ci-clang success clang PASS
prestwoj/iwd-ci-makecheckvalgrind success Make Check w/Valgrind
prestwoj/iwd-alpine-ci-makecheckvalgrind success Make Check w/Valgrind
prestwoj/iwd-alpine-ci-makecheck success Make Check
prestwoj/iwd-ci-makecheck success Make Check
prestwoj/iwd-ci-makedistcheck success Make Distcheck
prestwoj/iwd-ci-testrunner success test-runner PASS

Commit Message

James Prestwood Oct. 24, 2024, 1:16 p.m. UTC
If IPv6 is disabled or not supported at the kernel level writing the
sysfs settings will fail. A few of them had a support check but this
patch adds a supported bool to the remainder so we done get errors
like:

Unable to write drop_unsolicited_na to /proc/sys/net/ipv6/conf/wlan0/drop_unsolicited_na
---
 src/station.c | 36 ++++++++++++++++++++++++++++--------
 1 file changed, 28 insertions(+), 8 deletions(-)

Comments

Denis Kenzior Oct. 24, 2024, 2:16 p.m. UTC | #1
Hi James,

On 10/24/24 8:16 AM, James Prestwood wrote:
> If IPv6 is disabled or not supported at the kernel level writing the
> sysfs settings will fail. A few of them had a support check but this
> patch adds a supported bool to the remainder so we done get errors
> like:
> 
> Unable to write drop_unsolicited_na to /proc/sys/net/ipv6/conf/wlan0/drop_unsolicited_na
> ---
>   src/station.c | 36 ++++++++++++++++++++++++++++--------
>   1 file changed, 28 insertions(+), 8 deletions(-)
> 

Applied, thanks.

Regards,
-Denis
Martin Petzold Oct. 25, 2024, 11:14 a.m. UTC | #2
Hi James,

Am 24.10.24 um 15:16 schrieb James Prestwood:
> If IPv6 is disabled or not supported at the kernel level writing the
> sysfs settings will fail. A few of them had a support check but this
> patch adds a supported bool to the remainder so we done get errors
> like:
I have IPv6 disabled. What is the impact of this issue without the 
patches? Connection losses?
> Unable to write drop_unsolicited_na to /proc/sys/net/ipv6/conf/wlan0/drop_unsolicited_na
> ---
>   src/station.c | 36 ++++++++++++++++++++++++++++--------
>   1 file changed, 28 insertions(+), 8 deletions(-)
>
> diff --git a/src/station.c b/src/station.c
> index cef6c66a..34537b26 100644
> --- a/src/station.c
> +++ b/src/station.c
> @@ -74,6 +74,10 @@ static uint32_t roam_retry_interval;
>   static bool anqp_disabled;
>   static bool supports_arp_evict_nocarrier;
>   static bool supports_ndisc_evict_nocarrier;
> +static bool supports_drop_gratuitous_arp;
> +static bool supports_drop_unsolicited_na;
> +static bool supports_ipv4_drop_unicast_in_l2_multicast;
> +static bool supports_ipv6_drop_unicast_in_l2_multicast;
>   static struct watchlist event_watches;
>   static uint32_t known_networks_watch;
>   static uint32_t allowed_bands;
> @@ -1641,10 +1645,13 @@ static void station_set_drop_neighbor_discovery(struct station *station,
>   {
>   	char *v = value ? "1" : "0";
>   
> -	sysfs_write_ipv4_setting(netdev_get_name(station->netdev),
> -				"drop_gratuitous_arp", v);
> -	sysfs_write_ipv6_setting(netdev_get_name(station->netdev),
> -				"drop_unsolicited_na", v);
> +	if (supports_drop_gratuitous_arp)
> +		sysfs_write_ipv4_setting(netdev_get_name(station->netdev),
> +					"drop_gratuitous_arp", v);
> +
> +	if (supports_drop_unsolicited_na)
> +		sysfs_write_ipv6_setting(netdev_get_name(station->netdev),
> +					"drop_unsolicited_na", v);
>   }
>   
>   static void station_set_drop_unicast_l2_multicast(struct station *station,
> @@ -1652,10 +1659,13 @@ static void station_set_drop_unicast_l2_multicast(struct station *station,
>   {
>   	char *v = value ? "1" : "0";
>   
> -	sysfs_write_ipv4_setting(netdev_get_name(station->netdev),
> -				"drop_unicast_in_l2_multicast", v);
> -	sysfs_write_ipv6_setting(netdev_get_name(station->netdev),
> -				"drop_unicast_in_l2_multicast", v);
> +	if (supports_ipv4_drop_unicast_in_l2_multicast)
> +		sysfs_write_ipv4_setting(netdev_get_name(station->netdev),
> +					"drop_unicast_in_l2_multicast", v);
> +
> +	if (supports_ipv6_drop_unicast_in_l2_multicast)
> +		sysfs_write_ipv6_setting(netdev_get_name(station->netdev),
> +					"drop_unicast_in_l2_multicast", v);
>   }
>   
>   static void station_signal_agent_notify(struct station *station);
> @@ -5813,6 +5823,16 @@ static int station_init(void)
>   						"arp_evict_nocarrier");
>   	supports_ndisc_evict_nocarrier = sysfs_supports_ipv6_setting("all",
>   						"ndisc_evict_nocarrier");
> +	supports_drop_gratuitous_arp = sysfs_supports_ipv4_setting("all",
> +						"drop_gratuitous_arp");
> +	supports_drop_unsolicited_na = sysfs_supports_ipv6_setting("all",
> +						"drop_unsolicited_na");
> +	supports_ipv4_drop_unicast_in_l2_multicast =
> +					sysfs_supports_ipv4_setting("all",
> +					"drop_unicast_in_l2_multicast");
> +	supports_ipv6_drop_unicast_in_l2_multicast =
> +					sysfs_supports_ipv6_setting("all",
> +					"drop_unicast_in_l2_multicast");
>   
>   	watchlist_init(&event_watches, NULL);
>
James Prestwood Oct. 25, 2024, 11:37 a.m. UTC | #3
Hi Martin,

On 10/25/24 4:14 AM, Martin Petzold wrote:
> Hi James,
>
> Am 24.10.24 um 15:16 schrieb James Prestwood:
>> If IPv6 is disabled or not supported at the kernel level writing the
>> sysfs settings will fail. A few of them had a support check but this
>> patch adds a supported bool to the remainder so we done get errors
>> like:
> I have IPv6 disabled. What is the impact of this issue without the 
> patches? Connection losses?
No functional impact, its just silencing warning that occur when IPv6 is 
disabled.
>> Unable to write drop_unsolicited_na to 
>> /proc/sys/net/ipv6/conf/wlan0/drop_unsolicited_na
>> ---
>>   src/station.c | 36 ++++++++++++++++++++++++++++--------
>>   1 file changed, 28 insertions(+), 8 deletions(-)
>>
>> diff --git a/src/station.c b/src/station.c
>> index cef6c66a..34537b26 100644
>> --- a/src/station.c
>> +++ b/src/station.c
>> @@ -74,6 +74,10 @@ static uint32_t roam_retry_interval;
>>   static bool anqp_disabled;
>>   static bool supports_arp_evict_nocarrier;
>>   static bool supports_ndisc_evict_nocarrier;
>> +static bool supports_drop_gratuitous_arp;
>> +static bool supports_drop_unsolicited_na;
>> +static bool supports_ipv4_drop_unicast_in_l2_multicast;
>> +static bool supports_ipv6_drop_unicast_in_l2_multicast;
>>   static struct watchlist event_watches;
>>   static uint32_t known_networks_watch;
>>   static uint32_t allowed_bands;
>> @@ -1641,10 +1645,13 @@ static void 
>> station_set_drop_neighbor_discovery(struct station *station,
>>   {
>>       char *v = value ? "1" : "0";
>>   - sysfs_write_ipv4_setting(netdev_get_name(station->netdev),
>> -                "drop_gratuitous_arp", v);
>> - sysfs_write_ipv6_setting(netdev_get_name(station->netdev),
>> -                "drop_unsolicited_na", v);
>> +    if (supports_drop_gratuitous_arp)
>> + sysfs_write_ipv4_setting(netdev_get_name(station->netdev),
>> +                    "drop_gratuitous_arp", v);
>> +
>> +    if (supports_drop_unsolicited_na)
>> + sysfs_write_ipv6_setting(netdev_get_name(station->netdev),
>> +                    "drop_unsolicited_na", v);
>>   }
>>     static void station_set_drop_unicast_l2_multicast(struct station 
>> *station,
>> @@ -1652,10 +1659,13 @@ static void 
>> station_set_drop_unicast_l2_multicast(struct station *station,
>>   {
>>       char *v = value ? "1" : "0";
>>   - sysfs_write_ipv4_setting(netdev_get_name(station->netdev),
>> -                "drop_unicast_in_l2_multicast", v);
>> - sysfs_write_ipv6_setting(netdev_get_name(station->netdev),
>> -                "drop_unicast_in_l2_multicast", v);
>> +    if (supports_ipv4_drop_unicast_in_l2_multicast)
>> + sysfs_write_ipv4_setting(netdev_get_name(station->netdev),
>> +                    "drop_unicast_in_l2_multicast", v);
>> +
>> +    if (supports_ipv6_drop_unicast_in_l2_multicast)
>> + sysfs_write_ipv6_setting(netdev_get_name(station->netdev),
>> +                    "drop_unicast_in_l2_multicast", v);
>>   }
>>     static void station_signal_agent_notify(struct station *station);
>> @@ -5813,6 +5823,16 @@ static int station_init(void)
>>                           "arp_evict_nocarrier");
>>       supports_ndisc_evict_nocarrier = 
>> sysfs_supports_ipv6_setting("all",
>>                           "ndisc_evict_nocarrier");
>> +    supports_drop_gratuitous_arp = sysfs_supports_ipv4_setting("all",
>> +                        "drop_gratuitous_arp");
>> +    supports_drop_unsolicited_na = sysfs_supports_ipv6_setting("all",
>> +                        "drop_unsolicited_na");
>> +    supports_ipv4_drop_unicast_in_l2_multicast =
>> +                    sysfs_supports_ipv4_setting("all",
>> +                    "drop_unicast_in_l2_multicast");
>> +    supports_ipv6_drop_unicast_in_l2_multicast =
>> +                    sysfs_supports_ipv6_setting("all",
>> +                    "drop_unicast_in_l2_multicast");
>>         watchlist_init(&event_watches, NULL);
>
diff mbox series

Patch

diff --git a/src/station.c b/src/station.c
index cef6c66a..34537b26 100644
--- a/src/station.c
+++ b/src/station.c
@@ -74,6 +74,10 @@  static uint32_t roam_retry_interval;
 static bool anqp_disabled;
 static bool supports_arp_evict_nocarrier;
 static bool supports_ndisc_evict_nocarrier;
+static bool supports_drop_gratuitous_arp;
+static bool supports_drop_unsolicited_na;
+static bool supports_ipv4_drop_unicast_in_l2_multicast;
+static bool supports_ipv6_drop_unicast_in_l2_multicast;
 static struct watchlist event_watches;
 static uint32_t known_networks_watch;
 static uint32_t allowed_bands;
@@ -1641,10 +1645,13 @@  static void station_set_drop_neighbor_discovery(struct station *station,
 {
 	char *v = value ? "1" : "0";
 
-	sysfs_write_ipv4_setting(netdev_get_name(station->netdev),
-				"drop_gratuitous_arp", v);
-	sysfs_write_ipv6_setting(netdev_get_name(station->netdev),
-				"drop_unsolicited_na", v);
+	if (supports_drop_gratuitous_arp)
+		sysfs_write_ipv4_setting(netdev_get_name(station->netdev),
+					"drop_gratuitous_arp", v);
+
+	if (supports_drop_unsolicited_na)
+		sysfs_write_ipv6_setting(netdev_get_name(station->netdev),
+					"drop_unsolicited_na", v);
 }
 
 static void station_set_drop_unicast_l2_multicast(struct station *station,
@@ -1652,10 +1659,13 @@  static void station_set_drop_unicast_l2_multicast(struct station *station,
 {
 	char *v = value ? "1" : "0";
 
-	sysfs_write_ipv4_setting(netdev_get_name(station->netdev),
-				"drop_unicast_in_l2_multicast", v);
-	sysfs_write_ipv6_setting(netdev_get_name(station->netdev),
-				"drop_unicast_in_l2_multicast", v);
+	if (supports_ipv4_drop_unicast_in_l2_multicast)
+		sysfs_write_ipv4_setting(netdev_get_name(station->netdev),
+					"drop_unicast_in_l2_multicast", v);
+
+	if (supports_ipv6_drop_unicast_in_l2_multicast)
+		sysfs_write_ipv6_setting(netdev_get_name(station->netdev),
+					"drop_unicast_in_l2_multicast", v);
 }
 
 static void station_signal_agent_notify(struct station *station);
@@ -5813,6 +5823,16 @@  static int station_init(void)
 						"arp_evict_nocarrier");
 	supports_ndisc_evict_nocarrier = sysfs_supports_ipv6_setting("all",
 						"ndisc_evict_nocarrier");
+	supports_drop_gratuitous_arp = sysfs_supports_ipv4_setting("all",
+						"drop_gratuitous_arp");
+	supports_drop_unsolicited_na = sysfs_supports_ipv6_setting("all",
+						"drop_unsolicited_na");
+	supports_ipv4_drop_unicast_in_l2_multicast =
+					sysfs_supports_ipv4_setting("all",
+					"drop_unicast_in_l2_multicast");
+	supports_ipv6_drop_unicast_in_l2_multicast =
+					sysfs_supports_ipv6_setting("all",
+					"drop_unicast_in_l2_multicast");
 
 	watchlist_init(&event_watches, NULL);