[dpdk-dev] [PATCH v2] net: calculate checksums for packets with IPv4 options
Olivier Matz
olivier.matz at 6wind.com
Tue Oct 6 10:10:13 CEST 2020
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.
More information about the dev
mailing list