From: Marek Lindner <lindner_marek-LWAfsSFWpa4@public.gmane.org>
To: b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Dan Carpenter
<dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Subject: Re: question about frag_can_reassemble()
Date: Sat, 31 Mar 2012 11:52:42 +0300 [thread overview]
Message-ID: <201203311152.42590.lindner_marek@yahoo.de> (raw)
In-Reply-To: <20120330200236.GH3289@mwanda>
Dan,
> I had a question about the code in frag_can_reassemble().
>
> net/batman-adv/unicast.h
> 51
> 52 merged_size = (skb->len - sizeof(*unicast_packet)) * 2;
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 53 merged_size += sizeof(struct unicast_packet) +
> uneven_correction; 54
> 55 return merged_size <= mtu;
> 56 }
>
> Can the skb->len be less than sizeof(*unicast_packet) (ie 20 bytes)?
> If "len" is less than 10 then we would return false but if it's
> over 10 then we would return true. Roughly.
the calling function checks for an existing unicast header. The call tree
looks like this:
recv_ucast_frag_packet() -> route_unicast_packet() -> frag_can_reassemble()
The first function does a unicast length check by calling
check_unicast_packet(). As a result we ensure that we at least have the length
of the unicast header in our packet unless we overlooked something ?
Regards,
Marek
prev parent reply other threads:[~2012-03-31 8:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-30 20:02 question about frag_can_reassemble() Dan Carpenter
2012-03-31 8:52 ` Marek Lindner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201203311152.42590.lindner_marek@yahoo.de \
--to=lindner_marek-lwafssfwpa4@public.gmane.org \
--cc=b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org \
--cc=dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).