netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sabrina Dubroca <sd@queasysnail.net>
To: carlos.fernandez@technica-engineering.de
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] net: macsec SCI assignment for ES = 0
Date: Fri, 23 Jun 2023 17:40:29 +0200	[thread overview]
Message-ID: <ZJW87b0ijjBytbqB@hog> (raw)
In-Reply-To: <20230623101355.26790-1-carlos.fernandez@technica-engineering.de>

2023-06-23, 12:13:55 +0200, carlos.fernandez@technica-engineering.de wrote:
> Regarding ES, it is only set if the first 6 octets of the SCI are equal to the MAC, 
> in which case SC=0 as well (IEEE802.1AE 9.5 TAG Control information). 
> However, if ES=0, it is incorrect to use source MAC as SCI (current implementation)

But the spec doesn't really say what else we should be using.

Also, if it's incorrect to use the source MAC to build the SCI, we
shouldn't have the fallback that you added in v2/v3 in response to
Simon's comments (we'll probably end up dropping the packet when we
look for the rxsc/secy anyway).

> Regarding SC, as said in IEEE 802.1AE 9.9:
> 
> 
> "An explicitly encoded SCI field in the SecTAG is not required on point-to-point links, 
> which are identified by (...), if the transmitting SecY uses only one transmit SC. 
> In that case, the secure association created by the SecY for the peer SecYs, together with
> the direction of transmission of the secured MPDU, can be used to identify the transmitting SecY."

Thanks for the reference. This should be quoted in the commit message
to explain the reason for the change, as well as this sentence from 9.5:

    The ES bit is clear if the Source Address is not used to determine
    the SCI.

> Therefore the case SC=0 is reserved for cases where both conditions apply: point-to-point links, 
> and only one transmit SC. This requirement makes the size of the reception lookup 1.

That's the intention of the spec. We can't know that we'll only
receive such packets in situations where we have a single RXSC for the
entire real device.

I'm not too worried about the loop being slow (because it's a bit
unlikely that we'll go through lots of iterations on either loop
before we hit an active RXSC), but I'm not convinced that we should be
dumping those packets in the first RXSC we can find.

So I wonder if we should instead (only for ES=0 SC=0):
 - if we have exactly one RXSC for the lower device (ie across the 2
   loops), use it
 - otherwise (0 or > 1), drop the packet and increment InPktsNoSCI

and we can use MACSEC_UNDEF_SCI as return value to indicate a bogus
packet that needs to be dropped.

Would that take care of your use case?

-- 
Sabrina


  reply	other threads:[~2023-06-23 15:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20  9:13 [PATCH v3] net: macsec SCI assignment for ES = 0 carlos.fernandez
2023-06-22  0:34 ` Jakub Kicinski
2023-06-22  8:00   ` Carlos Fernandez
2023-06-22 11:49     ` Carlos Fernandez
2023-06-22 19:54       ` Sabrina Dubroca
2023-06-23 10:13         ` carlos.fernandez
2023-06-23 15:40           ` Sabrina Dubroca [this message]
2023-06-27  6:13             ` carlos.fernandez

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=ZJW87b0ijjBytbqB@hog \
    --to=sd@queasysnail.net \
    --cc=carlos.fernandez@technica-engineering.de \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).