[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAA85sZutqkV1seb3mV0exjLDNxN59jc0odJbpzejiKW--gAm9A@mail.gmail.com>
Date: Fri, 28 Jun 2024 12:36:08 +0200
From: Ian Kumlien <ian.kumlien@...il.com>
To: Linux Kernel Network Developers <netdev@...r.kernel.org>
Subject: Re: IP oversized ip oacket from - header size should be skipped?
On Fri, Jun 28, 2024 at 11:30 AM Ian Kumlien <ian.kumlien@...il.com> wrote:
>
> Hi,
>
> In net/ipv4/ip_fragment.c line 412:
> static int ip_frag_reasm(struct ipq *qp, struct sk_buff *skb,
> struct sk_buff *prev_tail, struct net_device *dev)
> {
> ...
> len = ip_hdrlen(skb) + qp->q.len;
> err = -E2BIG;
> if (len > 65535)
> goto out_oversize;
> ....
>
> We can expand the expression to:
> len = (ip_hdr(skb)->ihl * 4) + qp->q.len;
>
> But it's still weird since the definition of q->len is: "total length
> of the original datagram"
> Which should mean that we are comparing total length + ip header size
> instead of just total length?
So something like this:
git show 1fd2bd1e3335d0aa43e4ef2f55c7314f419026d7
commit 1fd2bd1e3335d0aa43e4ef2f55c7314f419026d7 (HEAD -> master)
Author: Ian Kumlien <ian.kumlien@...il.com>
Date: Fri Jun 28 12:30:24 2024 +0200
Omit extra ip header from calculation
Remove extra ip header from calculation of the
total length of the IP packet.
Fixes: c23f35d19db3b36ffb9e04b08f1d91565d15f84f
Signed-off-by: Ian KUmlien <ian.kumlien@...il.com>
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 08e2c92e25ab..e55a771919d6 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -431,7 +431,7 @@ static int ip_frag_reasm(struct ipq *qp, struct
sk_buff *skb,
if (!reasm_data)
goto out_nomem;
- len = ip_hdrlen(skb) + qp->q.len;
+ len = qp->q.len;
err = -E2BIG;
if (len > 65535)
goto out_oversize;
Powered by blists - more mailing lists