[PATCH 1/3] P2P: Rejecting provision discovery request for group client

Andrei Otcheretianski andrei.otc at gmail.com
Mon Aug 3 08:54:42 EDT 2015


I admit I couldn't find this part in the spec, but I guess the spec
specifies that a client may be connected to a single GO.
However, there is no obstacle to have multiple concurrent clients / go's.

On Mon, Aug 3, 2015 at 2:07 PM, Avichal Agarwal <avichal.a at samsung.com> wrote:
>
> From: Avichal Agarwal <avichal.a at samsung.com>
> Date: Mon, 3 Aug 2015 15:22:33 +0530
> Subject: [PATCH 1/3] P2P: Rejecting provision discovery request for group  client
>
> According to p2p specs when device is a group clent it should not recieve provision discovery request.
>
> Signed-off-by: Avichal Agarwal <avichal.a at samsung.com>
> ---
>  src/p2p/p2p_pd.c |   22 ++++++++++++++++++++--
>  1 file changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/src/p2p/p2p_pd.c b/src/p2p/p2p_pd.c
> index 065321c..92b1493 100644
> --- a/src/p2p/p2p_pd.c
> +++ b/src/p2p/p2p_pd.c
> @@ -431,8 +431,8 @@ void p2p_process_prov_disc_req(struct p2p_data *p2p, const u8 *sa,
>                                const u8 *data, size_t len, int rx_freq)
>  {
>         struct p2p_message msg;
> -       struct p2p_device *dev;
> -       int freq;
> +       struct p2p_device *dev,*n;
> +       int freq,failflag=0;
>         enum p2p_status_code reject = P2P_SC_FAIL_INCOMPATIBLE_PARAMS;
>         struct wpabuf *resp;
>         u32 adv_id = 0;
> @@ -455,8 +455,23 @@ void p2p_process_prov_disc_req(struct p2p_data *p2p, const u8 *sa,
>         p2p_dbg(p2p, "Received Provision Discovery Request from " MACSTR
>                 " with config methods 0x%x (freq=%d)",
>                 MAC2STR(sa), msg.wps_config_methods, rx_freq);
> +
> +       dl_list_for_each_safe(dev, n, &p2p->devices, struct p2p_device, list) {
> +               if (p2p->cfg->go_connected &&
> +                       p2p->cfg->go_connected(p2p->cfg->cb_ctx,
> +                               dev->info.p2p_device_addr)) {
> +                               p2p_dbg(p2p, " Already connected  Provision Discovery Request  Ignored\n");
> +                               reject = P2P_SC_FAIL_REJECTED_BY_USER;
> +                               failflag=1;
> +                               break;
> +                       }
> +       }
>
>         dev = p2p_get_device(p2p, sa);
> +
> +       if(dev && failflag)
> +               goto out;
> +
>         if (dev == NULL || (dev->flags & P2P_DEV_PROBE_REQ_ONLY)) {
>                 p2p_dbg(p2p, "Provision Discovery Request from unknown peer "
>                         MACSTR, MAC2STR(sa));
> @@ -471,6 +486,9 @@ void p2p_process_prov_disc_req(struct p2p_data *p2p, const u8 *sa,
>                 dev->info.wfd_subelems = wpabuf_dup(msg.wfd_subelems);
>         }
>
> +       if(failflag)
> +               goto out;
> +
>         if (msg.adv_id)
>                 allowed_config_methods |= WPS_CONFIG_P2PS;
>         else
> --
> 1.7.9.5
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap


More information about the HostAP mailing list