lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 10 Mar 2020 23:12:21 +0100
From:   Michal Kubecek <mkubecek@...e.cz>
To:     netdev@...r.kernel.org
Cc:     Andrej Ras <kermitthekoder@...il.com>
Subject: Re: What does this code do

On Tue, Mar 10, 2020 at 02:42:11PM -0700, Andrej Ras wrote:
> While browsing the Linux networking code I came across these two lines
> in __ip_append_data() which I do not understand.
> 
>                 /* Check if the remaining data fits into current packet. */
>                 copy = mtu - skb->len;
>                 if (copy < length)
>                         copy = maxfraglen - skb->len;
>                 if (copy <= 0) {
> 
> Why not just use maxfraglen.
> 
> Perhaps someone can explain why this is needed.

This function appends more data to an skb which can already contain some
payload. Therefore you need to take current length (from earlier) into
account, not only newly appended data.

This can be easily enforced e.g. with TCP_CORK or UDP_CORK socket option
or MSG_MORE flag.

Michal Kubecek

Powered by blists - more mailing lists