All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Zaborowski <andrew.zaborowski@intel.com>
To: iwd@lists.01.org
Subject: Re: [PATCH 02/16] scan: Hide CCK rates if no_cck_rates set
Date: Thu, 31 Oct 2019 02:25:36 +0100	[thread overview]
Message-ID: <CAOq732JY9sVoLx1a9V3GS1x+X8Q-S-8S05xNtjJt1zVs+3pO-g@mail.gmail.com> (raw)
In-Reply-To: <cc2d27cc-4251-b01e-9232-16bd80a23606@gmail.com>

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

Hi Denis,

On Wed, 30 Oct 2019 at 17:17, Denis Kenzior <denkenz@gmail.com> wrote:
> On 10/28/19 9:04 AM, Andrew Zaborowski wrote:
> > no_cck_rates is set in the scan parameters generally to make sure
> > that the Probe Request frames are not sent at any of the 802.11b
> > rates during active scans.  With this patch we also omit those rates
> > from the Supported Rates IEs, which is required by the p2p spec and
> > also matches our flag's name.
> > ---
> >   src/scan.c | 35 ++++++++++++++++++++++++++++++++++-
> >   1 file changed, 34 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/scan.c b/src/scan.c
> > index c0c3177e..0ec7831c 100644
> > --- a/src/scan.c
> > +++ b/src/scan.c
> > @@ -347,10 +347,43 @@ static struct l_genl_msg *scan_build_cmd(struct scan_context *sc,
> >       if (flags)
> >               l_genl_msg_append_attr(msg, NL80211_ATTR_SCAN_FLAGS, 4, &flags);
> >
> > -     if (params->no_cck_rates)
> > +     if (params->no_cck_rates) {
> > +             static const uint8_t b_rates[] = { 2, 4, 11, 22 };
> > +             uint8_t *scan_rates;
> > +             const uint8_t *supported;
> > +             unsigned int num_supported;
> > +             unsigned int count;
> > +
> >               l_genl_msg_append_attr(msg, NL80211_ATTR_TX_NO_CCK_RATE, 0,
> >                                       NULL);
> >
> > +             /*
> > +              * Assume if we're sending the probe requests at OFDM bit
> > +              * rates we don't want to advertise support for 802.11b rates.
> > +              */
> > +             supported = wiphy_get_supported_rates(sc->wiphy,
> > +                                                     NL80211_BAND_2GHZ,
> > +                                                     &num_supported);
> > +             if (!supported) {
> > +                     L_WARN_ON(true);
>
> So I will nag you not to do this, its just not very useful.  You really
> want the warning to convey as much info as possible.  Getting a message
> like "Warning: condition true failed" is pretty useless.
>
> Also, L_WARN_ON can be used in an if statement, FYI.

Ok, that should also work.  In the end you'll need to look at the
stack trace though.

>
> > +                     return msg;
> > +             }
> > +
> > +             scan_rates = l_malloc(num_supported);
> > +
> > +             for (count = 0; *supported; supported++)
> > +                     if (!memchr(b_rates, *supported, L_ARRAY_SIZE(b_rates)))
> > +                             scan_rates[count++] = *supported;
> > +
> > +             L_WARN_ON(!count);
> > +
> > +             l_genl_msg_enter_nested(msg, NL80211_ATTR_SCAN_SUPP_RATES);
> > +             l_genl_msg_append_attr(msg, NL80211_BAND_2GHZ, count,
> > +                                     scan_rates);
> > +             l_genl_msg_leave_nested(msg);
>
> Why are we bothering to send an empty attribute?

We aren't except if something's broken in our code.

>
> > +             l_free(scan_rates);
> > +     }
> > +
> >       return msg;
> >   }
> >
> >
>
> Anyhow, I made some mods to this commit and pushed it out.  Please review.

Thanks, this new version should also work.

Best regards

  reply	other threads:[~2019-10-31  1:25 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-28 14:04 [PATCH 01/16] wiphy: Add wiphy_get_supported_rates Andrew Zaborowski
2019-10-28 14:04 ` [PATCH 02/16] scan: Hide CCK rates if no_cck_rates set Andrew Zaborowski
2019-10-30 16:17   ` Denis Kenzior
2019-10-31  1:25     ` Andrew Zaborowski [this message]
2019-10-28 14:04 ` [PATCH 03/16] scan: Parse P2P IEs according to frame type Andrew Zaborowski
2019-10-30 16:52   ` Denis Kenzior
2019-10-31  1:45     ` Andrew Zaborowski
2019-10-28 14:04 ` [PATCH 04/16] scan: Add scan_bss_new_from_probe_req Andrew Zaborowski
2019-10-28 14:04 ` [PATCH 05/16] handshake: Convert handshake event callbacks variadic functions Andrew Zaborowski
2019-10-30 19:16   ` Denis Kenzior
2019-10-31  1:53     ` Andrew Zaborowski
2019-10-28 14:04 ` [PATCH 06/16] handshake: Convert HANDSHAKE_EVENT_FAILED data to int Andrew Zaborowski
2019-10-30 19:26   ` Denis Kenzior
2019-10-28 14:04 ` [PATCH 07/16] handshake: Drop NULL event params passed to handshake_event Andrew Zaborowski
2019-10-28 14:05 ` [PATCH 08/16] eapol: Move the EAP events to handshake event handler Andrew Zaborowski
2019-10-30 19:27   ` Denis Kenzior
2019-10-28 14:05 ` [PATCH 09/16] unit: Update event handler in WSC, eapol tests Andrew Zaborowski
2019-10-28 14:05 ` [PATCH 10/16] wsc: Replace netdev_connect_wsc with netdev_connect usage Andrew Zaborowski
2019-10-30 19:36   ` Denis Kenzior
2019-10-28 14:05 ` [PATCH 11/16] eapol: Drop unused eapol_sm_set_event_func Andrew Zaborowski
2019-10-30 19:34   ` Denis Kenzior
2019-10-28 14:05 ` [PATCH 12/16] netdev: Drop unused netdev_connect_wsc Andrew Zaborowski
2019-10-28 14:05 ` [PATCH 13/16] wsc: Declare the credentials structure in wsc.h Andrew Zaborowski
2019-10-28 14:05 ` [PATCH 14/16] wsc: Refactor to separate DBus-specific code Andrew Zaborowski
2019-11-04 17:37   ` Denis Kenzior
2019-10-28 14:05 ` [PATCH 15/16] wsc: Add wsc_new_p2p_enrollee Andrew Zaborowski
2019-10-28 14:05 ` [PATCH 16/16] wsc: Accept extra IEs in wsc_new_p2p_enrollee Andrew Zaborowski
2019-10-30 16:01 ` [PATCH 01/16] wiphy: Add wiphy_get_supported_rates Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOq732JY9sVoLx1a9V3GS1x+X8Q-S-8S05xNtjJt1zVs+3pO-g@mail.gmail.com \
    --to=andrew.zaborowski@intel.com \
    --cc=iwd@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.