[PATCH 1/3] Add getter and setter for EAPOL config parameters.

Dan Williams dcbw at redhat.com
Wed Nov 2 06:57:41 PDT 2016


On Wed, 2016-11-02 at 15:48 +0530, Nishant Chaprana wrote:
> This patch adds setter and getter for EAPOL config parameters :-
> 1. ip_addr_go
> 2. ip_addr_mask
> 3. ip_addr_start
> 4. ip_addr_end
> 
> Signed-off-by: Nishant Chaprana <n.chaprana at samsung.com>
> ---
>  wpa_supplicant/dbus/dbus_new_handlers_p2p.c | 61
> +++++++++++++++++++++++++++++
>  1 file changed, 61 insertions(+)
> 
> diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
> b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
> index 73b9e20..3b68a30 100644
> --- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
> +++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
> @@ -867,6 +867,30 @@ dbus_bool_t wpas_dbus_getter_p2p_device_config(
>  			goto err_no_mem;
>  	}
>  
> +	/* IP Address GO */
> +	if (!wpa_dbus_dict_append_byte_array(&dict_iter, "IpAddrGo",
> +					     (char *) wpa_s->conf-
> >ip_addr_go,
> +					     4))
> +		goto err_no_mem;
> +
> +	/* IP Address mask */
> +	if (!wpa_dbus_dict_append_byte_array(&dict_iter,
> "IpAddrMask",
> +					     (char *) wpa_s->conf-
> >ip_addr_mask,
> +					     4))
> +		goto err_no_mem;
> +
> +	/* IP Address Start*/
> +	if (!wpa_dbus_dict_append_byte_array(&dict_iter,
> "IpAddrStart",
> +					     (char *) wpa_s->conf-
> >ip_addr_start,
> +					     4))
> +		goto err_no_mem;
> +
> +	/* IP Address End*/
> +	if (!wpa_dbus_dict_append_byte_array(&dict_iter,
> "IpAddrEnd",
> +					     (char *) wpa_s->conf-
> >ip_addr_end,
> +					     4))
> +		goto err_no_mem;
> +
>  	/* Vendor Extensions */
>  	for (i = 0; i < P2P_MAX_WPS_VENDOR_EXT; i++) {
>  		if (wpa_s->conf->wps_vendor_ext[i] == NULL)
> @@ -1051,6 +1075,43 @@ dbus_bool_t
> wpas_dbus_setter_p2p_device_config(
>  			wpa_s->conf->p2p_intra_bss =
> entry.bool_value;
>  			wpa_s->conf->changed_parameters |=
>  				CFG_CHANGED_P2P_INTRA_BSS;
> +
> +		} else if (os_strcmp(entry.key, "IpAddrGo") == 0) {
> +			if (entry.type != DBUS_TYPE_ARRAY ||
> +			    entry.array_type != DBUS_TYPE_BYTE ||
> +			    entry.array_len != 4)
> +				goto error;

This gets used a couple of times, maybe it should be a small inline
helper function called something like validate_dbus_ipaddr()?

Dan

> +			os_memcpy(wpa_s->conf->ip_addr_go,
> +				  entry.bytearray_value, 4);
> +
> +		} else if (os_strcmp(entry.key, "IpAddrMask") == 0)
> {
> +			if (entry.type != DBUS_TYPE_ARRAY ||
> +			    entry.array_type != DBUS_TYPE_BYTE ||
> +			    entry.array_len != 4)
> +				goto error;
> +
> +			os_memcpy(wpa_s->conf->ip_addr_mask,
> +				  entry.bytearray_value, 4);
> +
> +		} else if (os_strcmp(entry.key, "IpAddrStart") == 0)
> {
> +			if (entry.type != DBUS_TYPE_ARRAY ||
> +			    entry.array_type != DBUS_TYPE_BYTE ||
> +			    entry.array_len != 4)
> +				goto error;
> +
> +			os_memcpy(wpa_s->conf->ip_addr_start,
> +				  entry.bytearray_value, 4);
> +
> +		} else if (os_strcmp(entry.key, "IpAddrEnd") == 0) {
> +			if (entry.type != DBUS_TYPE_ARRAY ||
> +			    entry.array_type != DBUS_TYPE_BYTE ||
> +			    entry.array_len != 4)
> +				goto error;
> +
> +			os_memcpy(wpa_s->conf->ip_addr_end,
> +				  entry.bytearray_value, 4);
> +
>  		} else if (os_strcmp(entry.key, "GroupIdle") == 0 &&
>  			   entry.type == DBUS_TYPE_UINT32)
>  			wpa_s->conf->p2p_group_idle =
> entry.uint32_value;



More information about the Hostap mailing list