diff mbox series

[wpan-next,v5] mac802154: Ensure proper scan-level filtering

Message ID 20221018183540.806471-1-miquel.raynal@bootlin.com (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series [wpan-next,v5] mac802154: Ensure proper scan-level filtering | expand

Checks

Context Check Description
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Miquel Raynal Oct. 18, 2022, 6:35 p.m. UTC
We now have a fine grained filtering information so let's ensure proper
filtering in scan mode, which means that only beacons are processed.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---

Changes in v4:
* dev_dbg call with: s/!beacon/non-beacon/.
* Rebased on top of wpan-next but there is still a commit that has not
  been merged (went through a fixes PR), but is already in Linus' tree
  and was present in my branch when I generated this patch.

 net/mac802154/rx.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

Comments

Alexander Aring Oct. 18, 2022, 8:54 p.m. UTC | #1
Hi,

On Tue, Oct 18, 2022 at 2:35 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>
> We now have a fine grained filtering information so let's ensure proper
> filtering in scan mode, which means that only beacons are processed.
>

Is this a fixup? Can you resend the whole series please?

- Alex
Miquel Raynal Oct. 18, 2022, 10:03 p.m. UTC | #2
Hi Alexander,

aahringo@redhat.com wrote on Tue, 18 Oct 2022 16:54:13 -0400:

> Hi,
> 
> On Tue, Oct 18, 2022 at 2:35 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> >
> > We now have a fine grained filtering information so let's ensure proper
> > filtering in scan mode, which means that only beacons are processed.
> >  
> 
> Is this a fixup? Can you resend the whole series please?

Hmm no? Unless I understood things the wrong way, Stefan applied
patches 1 to 7 of my v4, and asked me to make a change on the 8th
patch.

This is v5 just for patch 8/8 of the previous series, I just changed
a debug string actually...

There was a conflict when he applied it but I believe this is because
wpan-next did not contain one of the fixes which made it to Linus' tree
a month ago. So in my branch I still have this fix prior to this patch,
because otherwise there will be a conflict when merging v6.1-rc1 (which
I believe was not done yet). 

Thanks,
Miquèl
Alexander Aring Oct. 18, 2022, 10:56 p.m. UTC | #3
Hi,

On Tue, Oct 18, 2022 at 6:03 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>
> Hi Alexander,
>
> aahringo@redhat.com wrote on Tue, 18 Oct 2022 16:54:13 -0400:
>
> > Hi,
> >
> > On Tue, Oct 18, 2022 at 2:35 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> > >
> > > We now have a fine grained filtering information so let's ensure proper
> > > filtering in scan mode, which means that only beacons are processed.
> > >
> >
> > Is this a fixup? Can you resend the whole series please?
>
> Hmm no? Unless I understood things the wrong way, Stefan applied
> patches 1 to 7 of my v4, and asked me to make a change on the 8th
> patch.
>
> This is v5 just for patch 8/8 of the previous series, I just changed
> a debug string actually...
>

Okay, I see there are multiple new patches on the list, can you resend
them in one series? Then we have the right order how they need to be
applied without figuring it "somehow" out.

> There was a conflict when he applied it but I believe this is because
> wpan-next did not contain one of the fixes which made it to Linus' tree
> a month ago. So in my branch I still have this fix prior to this patch,
> because otherwise there will be a conflict when merging v6.1-rc1 (which
> I believe was not done yet).
>

I see. Thanks.

- Alex
Miquel Raynal Oct. 19, 2022, 7:34 a.m. UTC | #4
Hi Alexander,

aahringo@redhat.com wrote on Tue, 18 Oct 2022 18:56:49 -0400:

> Hi,
> 
> On Tue, Oct 18, 2022 at 6:03 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> >
> > Hi Alexander,
> >
> > aahringo@redhat.com wrote on Tue, 18 Oct 2022 16:54:13 -0400:
> >  
> > > Hi,
> > >
> > > On Tue, Oct 18, 2022 at 2:35 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:  
> > > >
> > > > We now have a fine grained filtering information so let's ensure proper
> > > > filtering in scan mode, which means that only beacons are processed.
> > > >  
> > >
> > > Is this a fixup? Can you resend the whole series please?  
> >
> > Hmm no? Unless I understood things the wrong way, Stefan applied
> > patches 1 to 7 of my v4, and asked me to make a change on the 8th
> > patch.
> >
> > This is v5 just for patch 8/8 of the previous series, I just changed
> > a debug string actually...
> >  
> 
> Okay, I see there are multiple new patches on the list, can you resend
> them in one series? Then we have the right order how they need to be
> applied without figuring it "somehow" out.

The order should not matter much, that's why I posted them as individual
patches. But no problem, I'll resent the three "followup" patches in a
series.

However, the patch for allowing coordinator interfaces should be
considered something else, I've sent it to start discussing it as the
other patches should not require a lot of review time I guess. I didn't
think it made sense to wrap it in the followup series as this is
mainly something new, but I'm fine doing it, the first patches can go
in while we still discuss it further.

> > There was a conflict when he applied it but I believe this is because
> > wpan-next did not contain one of the fixes which made it to Linus' tree
> > a month ago. So in my branch I still have this fix prior to this patch,
> > because otherwise there will be a conflict when merging v6.1-rc1 (which
> > I believe was not done yet).
> >  
> 
> I see. Thanks.
> 
> - Alex
> 

Thanks,
Miquèl
Stefan Schmidt Oct. 19, 2022, 8:06 a.m. UTC | #5
Hello.

On 19.10.22 00:03, Miquel Raynal wrote:
> Hi Alexander,
> 
> aahringo@redhat.com wrote on Tue, 18 Oct 2022 16:54:13 -0400:
> 
>> Hi,
>>
>> On Tue, Oct 18, 2022 at 2:35 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>>>
>>> We now have a fine grained filtering information so let's ensure proper
>>> filtering in scan mode, which means that only beacons are processed.
>>>   
>>
>> Is this a fixup? Can you resend the whole series please?
> 
> Hmm no? Unless I understood things the wrong way, Stefan applied
> patches 1 to 7 of my v4, and asked me to make a change on the 8th
> patch.
> 
> This is v5 just for patch 8/8 of the previous series, I just changed
> a debug string actually...
> 
> There was a conflict when he applied it but I believe this is because
> wpan-next did not contain one of the fixes which made it to Linus' tree
> a month ago. So in my branch I still have this fix prior to this patch,
> because otherwise there will be a conflict when merging v6.1-rc1 (which
> I believe was not done yet).

You believe correctly. :-) In my workflow I normally do not merge in 
changes from net-next until after my latest pull-request was pulled in. 
I do this to avoid extra merge commits.

In case I see a merge conflict in my testing before sending the pull 
request I add merge guidance to the pull. Which is my plan this time 
around as well.

regards
Stefan Schmidt
Miquel Raynal Oct. 19, 2022, 8:17 a.m. UTC | #6
Hi Stefan,

stefan@datenfreihafen.org wrote on Wed, 19 Oct 2022 10:06:05 +0200:

> Hello.
> 
> On 19.10.22 00:03, Miquel Raynal wrote:
> > Hi Alexander,
> > 
> > aahringo@redhat.com wrote on Tue, 18 Oct 2022 16:54:13 -0400:
> >   
> >> Hi,
> >>
> >> On Tue, Oct 18, 2022 at 2:35 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:  
> >>>
> >>> We now have a fine grained filtering information so let's ensure proper
> >>> filtering in scan mode, which means that only beacons are processed.  
> >>>   >>  
> >> Is this a fixup? Can you resend the whole series please?  
> > 
> > Hmm no? Unless I understood things the wrong way, Stefan applied
> > patches 1 to 7 of my v4, and asked me to make a change on the 8th
> > patch.
> > 
> > This is v5 just for patch 8/8 of the previous series, I just changed
> > a debug string actually...
> > 
> > There was a conflict when he applied it but I believe this is because
> > wpan-next did not contain one of the fixes which made it to Linus' tree
> > a month ago. So in my branch I still have this fix prior to this patch,
> > because otherwise there will be a conflict when merging v6.1-rc1 (which
> > I believe was not done yet).  
> 
> You believe correctly. :-) In my workflow I normally do not merge in changes from net-next until after my latest pull-request was pulled in. I do this to avoid extra merge commits.
> 
> In case I see a merge conflict in my testing before sending the pull request I add merge guidance to the pull. Which is my plan this time around as well.

Do you mean I should drop the fix from my branch and give you a patch
which applies on the current wpan-next instead?

Thanks,
Miquèl
Stefan Schmidt Oct. 19, 2022, 8:20 a.m. UTC | #7
Hello.

On 19.10.22 10:17, Miquel Raynal wrote:
> Hi Stefan,
> 
> stefan@datenfreihafen.org wrote on Wed, 19 Oct 2022 10:06:05 +0200:
> 
>> Hello.
>>
>> On 19.10.22 00:03, Miquel Raynal wrote:
>>> Hi Alexander,
>>>
>>> aahringo@redhat.com wrote on Tue, 18 Oct 2022 16:54:13 -0400:
>>>    
>>>> Hi,
>>>>
>>>> On Tue, Oct 18, 2022 at 2:35 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>>>>>
>>>>> We now have a fine grained filtering information so let's ensure proper
>>>>> filtering in scan mode, which means that only beacons are processed.
>>>>>    >>
>>>> Is this a fixup? Can you resend the whole series please?
>>>
>>> Hmm no? Unless I understood things the wrong way, Stefan applied
>>> patches 1 to 7 of my v4, and asked me to make a change on the 8th
>>> patch.
>>>
>>> This is v5 just for patch 8/8 of the previous series, I just changed
>>> a debug string actually...
>>>
>>> There was a conflict when he applied it but I believe this is because
>>> wpan-next did not contain one of the fixes which made it to Linus' tree
>>> a month ago. So in my branch I still have this fix prior to this patch,
>>> because otherwise there will be a conflict when merging v6.1-rc1 (which
>>> I believe was not done yet).
>>
>> You believe correctly. :-) In my workflow I normally do not merge in changes from net-next until after my latest pull-request was pulled in. I do this to avoid extra merge commits.
>>
>> In case I see a merge conflict in my testing before sending the pull request I add merge guidance to the pull. Which is my plan this time around as well.
> 
> Do you mean I should drop the fix from my branch and give you a patch
> which applies on the current wpan-next instead?

Yes, that is my understanding on rebasing a patch on wpan-next :-)

regards
Stefan Schmidt
diff mbox series

Patch

diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c
index 14bc646b9ab7..2ae23a2f4a09 100644
--- a/net/mac802154/rx.c
+++ b/net/mac802154/rx.c
@@ -34,6 +34,7 @@  ieee802154_subif_frame(struct ieee802154_sub_if_data *sdata,
 		       struct sk_buff *skb, const struct ieee802154_hdr *hdr)
 {
 	struct wpan_dev *wpan_dev = &sdata->wpan_dev;
+	struct wpan_phy *wpan_phy = sdata->local->hw.phy;
 	__le16 span, sshort;
 	int rc;
 
@@ -42,6 +43,17 @@  ieee802154_subif_frame(struct ieee802154_sub_if_data *sdata,
 	span = wpan_dev->pan_id;
 	sshort = wpan_dev->short_addr;
 
+	/* Level 3 filtering: Only beacons are accepted during scans */
+	if (sdata->required_filtering == IEEE802154_FILTERING_3_SCAN &&
+	    sdata->required_filtering > wpan_phy->filtering) {
+		if (mac_cb(skb)->type != IEEE802154_FC_TYPE_BEACON) {
+			dev_dbg(&sdata->dev->dev,
+				"drop non-beacon frame (0x%x) during scan\n",
+				mac_cb(skb)->type);
+			goto fail;
+		}
+	}
+
 	switch (mac_cb(skb)->dest.mode) {
 	case IEEE802154_ADDR_NONE:
 		if (hdr->source.mode != IEEE802154_ADDR_NONE)
@@ -277,10 +289,6 @@  void ieee802154_rx(struct ieee802154_local *local, struct sk_buff *skb)
 
 	ieee802154_monitors_rx(local, skb);
 
-	/* TODO: Handle upcomming receive path where the PHY is at the
-	 * IEEE802154_FILTERING_NONE level during a scan.
-	 */
-
 	/* Level 1 filtering: Check the FCS by software when relevant */
 	if (local->hw.phy->filtering == IEEE802154_FILTERING_NONE) {
 		crc = crc_ccitt(0, skb->data, skb->len);