diff mbox series

[v3,2/8] netdev: define netdev settings in netdev.h

Message ID 20240823180006.317353-2-prestwoj@gmail.com (mailing list archive)
State New
Headers show
Series [v3,1/8] doc: Document station Affinities property | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-ci-gitlint success GitLint

Commit Message

James Prestwood Aug. 23, 2024, 6 p.m. UTC
Following knownnetworks, this moves the settings into a header file
which is easier to maintain/read.
---
 src/netdev.c | 8 ++++----
 src/netdev.h | 5 +++++
 2 files changed, 9 insertions(+), 4 deletions(-)

Comments

Ryan Smith Aug. 23, 2024, 9:03 p.m. UTC | #1
Hi,
Just glancing through this...

On Fri, Aug 23, 2024 at 12:00 PM James Prestwood <prestwoj@gmail.com> wrote:
>
> Following knownnetworks, this moves the settings into a header file
> which is easier to maintain/read.
> ---
>  src/netdev.c | 8 ++++----
>  src/netdev.h | 5 +++++
>  2 files changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/src/netdev.c b/src/netdev.c
> index 494e46a5..4d6aae6b 100644
> --- a/src/netdev.c
> +++ b/src/netdev.c
> @@ -6264,16 +6264,16 @@ static int netdev_init(void)
>                 goto fail_netlink;
>         }
>
> -       if (!l_settings_get_int(settings, "General", "RoamThreshold",
> +       if (!l_settings_get_int(settings, NETDEV_ROAM_THRESHOLD,
>                                         &LOW_SIGNAL_THRESHOLD))
>                 LOW_SIGNAL_THRESHOLD = -70;
>
> -       if (!l_settings_get_int(settings, "General", "RoamThreshold5G",
> +       if (!l_settings_get_int(settings, NETDEV_ROAM_TRHESHOLD_5G,
>                                         &LOW_SIGNAL_THRESHOLD_5GHZ))
>                 LOW_SIGNAL_THRESHOLD_5GHZ = -76;
>
> -       rand_addr_str = l_settings_get_value(settings, "General",
> -                                               "AddressRandomization");
> +       rand_addr_str = l_settings_get_value(settings,
> +                                               NETDEV_ADDRESS_RANDOMIZATION);
>         if (rand_addr_str && !strcmp(rand_addr_str, "network"))
>                 mac_per_ssid = true;
>
> diff --git a/src/netdev.h b/src/netdev.h
> index db0440d0..d718fa6a 100644
> --- a/src/netdev.h
> +++ b/src/netdev.h
> @@ -29,6 +29,11 @@ struct eapol_sm;
>  struct mmpdu_header;
>  struct diagnostic_station_info;
>
> +#define GENERAL "General"
> +#define NETDEV_ADDRESS_RANDOMIZATION GENERAL, "AddressRandomization"
> +#define NETDEV_ROAM_THRESHOLD GENERAL, "RoamTreshold"

Spelling typo - RoamThreshold

> +#define NETDEV_ROAM_TRHESHOLD_5G GENERAL, "RoamThreshold5G"

Spelling typo - NETDEV_ROAM_THRESHOLD_5G

> +
>  enum netdev_result {
>         NETDEV_RESULT_OK,
>         NETDEV_RESULT_AUTHENTICATION_FAILED,
> --
> 2.34.1
>
>
James Prestwood Aug. 23, 2024, 10:24 p.m. UTC | #2
Hi Ryan,

On 8/23/24 2:03 PM, Ryan Smith wrote:
> Hi,
> Just glancing through this...
>
> On Fri, Aug 23, 2024 at 12:00 PM James Prestwood <prestwoj@gmail.com> wrote:
>> Following knownnetworks, this moves the settings into a header file
>> which is easier to maintain/read.
>> ---
>>   src/netdev.c | 8 ++++----
>>   src/netdev.h | 5 +++++
>>   2 files changed, 9 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/netdev.c b/src/netdev.c
>> index 494e46a5..4d6aae6b 100644
>> --- a/src/netdev.c
>> +++ b/src/netdev.c
>> @@ -6264,16 +6264,16 @@ static int netdev_init(void)
>>                  goto fail_netlink;
>>          }
>>
>> -       if (!l_settings_get_int(settings, "General", "RoamThreshold",
>> +       if (!l_settings_get_int(settings, NETDEV_ROAM_THRESHOLD,
>>                                          &LOW_SIGNAL_THRESHOLD))
>>                  LOW_SIGNAL_THRESHOLD = -70;
>>
>> -       if (!l_settings_get_int(settings, "General", "RoamThreshold5G",
>> +       if (!l_settings_get_int(settings, NETDEV_ROAM_TRHESHOLD_5G,
>>                                          &LOW_SIGNAL_THRESHOLD_5GHZ))
>>                  LOW_SIGNAL_THRESHOLD_5GHZ = -76;
>>
>> -       rand_addr_str = l_settings_get_value(settings, "General",
>> -                                               "AddressRandomization");
>> +       rand_addr_str = l_settings_get_value(settings,
>> +                                               NETDEV_ADDRESS_RANDOMIZATION);
>>          if (rand_addr_str && !strcmp(rand_addr_str, "network"))
>>                  mac_per_ssid = true;
>>
>> diff --git a/src/netdev.h b/src/netdev.h
>> index db0440d0..d718fa6a 100644
>> --- a/src/netdev.h
>> +++ b/src/netdev.h
>> @@ -29,6 +29,11 @@ struct eapol_sm;
>>   struct mmpdu_header;
>>   struct diagnostic_station_info;
>>
>> +#define GENERAL "General"
>> +#define NETDEV_ADDRESS_RANDOMIZATION GENERAL, "AddressRandomization"
>> +#define NETDEV_ROAM_THRESHOLD GENERAL, "RoamTreshold"
> Spelling typo - RoamThreshold
>
>> +#define NETDEV_ROAM_TRHESHOLD_5G GENERAL, "RoamThreshold5G"
> Spelling typo - NETDEV_ROAM_THRESHOLD_5G
>
>> +
>>   enum netdev_result {
>>          NETDEV_RESULT_OK,
>>          NETDEV_RESULT_AUTHENTICATION_FAILED,
>> --
>> 2.34.1
>>
>>
Thanks, good catch!
diff mbox series

Patch

diff --git a/src/netdev.c b/src/netdev.c
index 494e46a5..4d6aae6b 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -6264,16 +6264,16 @@  static int netdev_init(void)
 		goto fail_netlink;
 	}
 
-	if (!l_settings_get_int(settings, "General", "RoamThreshold",
+	if (!l_settings_get_int(settings, NETDEV_ROAM_THRESHOLD,
 					&LOW_SIGNAL_THRESHOLD))
 		LOW_SIGNAL_THRESHOLD = -70;
 
-	if (!l_settings_get_int(settings, "General", "RoamThreshold5G",
+	if (!l_settings_get_int(settings, NETDEV_ROAM_TRHESHOLD_5G,
 					&LOW_SIGNAL_THRESHOLD_5GHZ))
 		LOW_SIGNAL_THRESHOLD_5GHZ = -76;
 
-	rand_addr_str = l_settings_get_value(settings, "General",
-						"AddressRandomization");
+	rand_addr_str = l_settings_get_value(settings,
+						NETDEV_ADDRESS_RANDOMIZATION);
 	if (rand_addr_str && !strcmp(rand_addr_str, "network"))
 		mac_per_ssid = true;
 
diff --git a/src/netdev.h b/src/netdev.h
index db0440d0..d718fa6a 100644
--- a/src/netdev.h
+++ b/src/netdev.h
@@ -29,6 +29,11 @@  struct eapol_sm;
 struct mmpdu_header;
 struct diagnostic_station_info;
 
+#define GENERAL "General"
+#define NETDEV_ADDRESS_RANDOMIZATION GENERAL, "AddressRandomization"
+#define NETDEV_ROAM_THRESHOLD GENERAL, "RoamTreshold"
+#define NETDEV_ROAM_TRHESHOLD_5G GENERAL, "RoamThreshold5G"
+
 enum netdev_result {
 	NETDEV_RESULT_OK,
 	NETDEV_RESULT_AUTHENTICATION_FAILED,