Re: [PATCH net-next v4 3/5] net: hdlc_fr: Improve the initial checks when we receive an skb
From: Xie He
Date: Fri Oct 30 2020 - 15:22:30 EST
On Fri, Oct 30, 2020 at 9:31 AM Willem de Bruijn
<willemdebruijn.kernel@xxxxxxxxx> wrote:
>
> > Add an fh->ea2 check to the initial checks in fr_rx. fh->ea2 == 1 means
> > the second address byte is the final address byte. We only support the
> > case where the address length is 2 bytes.
>
> Can you elaborate a bit for readers not intimately familiar with the codebase?
>
> Is there something in the following code that has this implicit
> assumption on 2-byte address lengths?
Yes, the address length must be 2 bytes, otherwise the 3rd and 4th
bytes would not be the control and protocol fields as we assumed in
the code.
The frame format is specified in RFC 2427
(https://tools.ietf.org/html/rfc2427). We can see the overall frame
format on Page 3. If the address length is longer than 2 bytes, all
the following fields will be shifted behind.