[dpdk-dev] [PATCH v2] net: calculate checksums for packets with IPv4 options
Michael Pfeiffer
michael.pfeiffer at tu-ilmenau.de
Tue Oct 6 11:51:04 CEST 2020
Hi,
On Tue, 2020-10-06 at 10:10 +0200, Olivier Matz wrote:
> On Mon, Oct 05, 2020 at 07:39:45PM -0700, Stephen Hemminger wrote:
> > On Tue, 06 Oct 2020 00:55:19 +0200
> > Thomas Monjalon <thomas at monjalon.net> wrote:
> > >
> > > On 9/1/20 12:47 PM, Michael Pfeiffer wrote:
> > > > Currently, rte_ipv4_cksum() and rte_ipv4_udptcp_cksum() assume all IPv4
> > > > headers have sizeof(struct rte_ipv4_hdr) bytes. This is not true for
> > > > those (rare) packets with IPv4 options. Thus, both IPv4 and TCP/UDP
> > > > checksums are calculated wrong.
> > > >
> > > > This patch fixes the issue by using the actual IPv4 header length from
> > > > the packet's IHL field.
> > > >
> > > > Signed-off-by: Michael Pfeiffer <michael.pfeiffer at tu-ilmenau.de>
>
> Acked-by: Olivier Matz <olivier.matz at 6wind.com>
>
> > > > - cksum = rte_raw_cksum(ipv4_hdr, sizeof(struct rte_ipv4_hdr));
> > > > + cksum = rte_raw_cksum(ipv4_hdr, (ipv4_hdr->version_ihl & 0xf) *
> > > > 4);
> > >
> > > Truly naive questions:
> > > - doesn't it deserve a static inline function rte_ipv4_hdr_len()?
> >
> > Makes sense to have that.
>
> +1
>
> However it could be in another patch: there are ~15 places where it
> could be replaced in dpdk.
Thank you very much for your feedback. I will prepare a second patch for that
function.
More information about the dev
mailing list