[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK-6q+iQprUr3JJCytxbAUC-QLxaSRgz6WO+U=bZ6L9rxYHFfg@mail.gmail.com>
Date: Sun, 16 Apr 2023 17:31:32 -0400
From: Alexander Aring <aahringo@...hat.com>
To: David Ahern <dsahern@...nel.org>
Cc: netdev@...r.kernel.org, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, alex.aring@...il.com,
daniel@...earbox.net, ymittal@...hat.com, mcascell@...hat.com,
torvalds@...uxfoundation.org, mcr@...delman.ca
Subject: Re: [PATCH net] net: rpl: fix rpl header size calculation
Hi,
On Sun, Apr 16, 2023 at 12:37 PM David Ahern <dsahern@...nel.org> wrote:
>
> On 4/15/23 3:05 PM, Alexander Aring wrote:
> > diff --git a/net/ipv6/rpl.c b/net/ipv6/rpl.c
> > index 488aec9e1a74..16e19fec18a4 100644
> > --- a/net/ipv6/rpl.c
> > +++ b/net/ipv6/rpl.c
> > @@ -32,7 +32,7 @@ static void *ipv6_rpl_segdata_pos(const struct ipv6_rpl_sr_hdr *hdr, int i)
> > size_t ipv6_rpl_srh_size(unsigned char n, unsigned char cmpri,
> > unsigned char cmpre)
> > {
> > - return (n * IPV6_PFXTAIL_LEN(cmpri)) + IPV6_PFXTAIL_LEN(cmpre);
> > + return 8 + (n * IPV6_PFXTAIL_LEN(cmpri)) + IPV6_PFXTAIL_LEN(cmpre);
>
>
>
> no magic numbers; there should be a macro for that size.
>
ok. We can actually use sizeof(*hdr) here. Which is actually the
header size without the "addresses" payload.
Thanks.
- Alex
Powered by blists - more mailing lists