From: "Martin Hundebøll" <martin@hundeboll.net>
To: The list for a Better Approach To Mobile Ad-hoc Networking
<b.a.t.m.a.n@lists.open-mesh.org>
Cc: Sven Eckelmann <sven@narfation.org>
Subject: Re: [B.A.T.M.A.N.] [PATCHv3 2/2] batman-adv: Use only queued fragments when merging
Date: Mon, 01 Dec 2014 12:40:53 +0100 [thread overview]
Message-ID: <547C53C5.7090205@hundeboll.net> (raw)
In-Reply-To: <1417426648-9319-2-git-send-email-sven@narfation.org>
Hi Sven,
On 2014-12-01 10:37, Sven Eckelmann wrote:
> The fragment queueing code now validates the total_size of each fragment,
> checks when enough fragments are queued to allow to merge them into a single
> packet and if the fragments have the correct size. Therefore, it is not
> required to have any other parameter for the merging function than a list of
> queued fragments.
>
> This change should avoid problems like in the past when the different skb from
> the list and the function parameter were mixed incorrectly.
>
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
> fragmentation.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/fragmentation.c b/fragmentation.c
> index 6e4c957..0ab228f 100644
> --- a/fragmentation.c
> +++ b/fragmentation.c
> @@ -231,19 +231,13 @@ err:
> * Returns the merged skb or NULL on error.
> */
> static struct sk_buff *
> -batadv_frag_merge_packets(struct hlist_head *chain, struct sk_buff *skb)
> +batadv_frag_merge_packets(struct hlist_head *chain)
> {
> struct batadv_frag_packet *packet;
> struct batadv_frag_list_entry *entry;
> struct sk_buff *skb_out = NULL;
> int size, hdr_size = sizeof(struct batadv_frag_packet);
>
> - /* Make sure incoming skb has non-bogus data. */
> - packet = (struct batadv_frag_packet *)skb->data;
> - size = ntohs(packet->total_size);
> - if (size > batadv_frag_size_limit())
> - goto free;
> -
> /* Remove first entry, as this is the destination for the rest of the
> * fragments.
> */
> @@ -252,6 +246,9 @@ batadv_frag_merge_packets(struct hlist_head *chain, struct sk_buff *skb)
> skb_out = entry->skb;
> kfree(entry);
>
> + packet = (struct batadv_frag_packet *)skb_out->data;
> + size = ntohs(packet->total_size);
> +
> /* Make room for the rest of the fragments. */
> if (pskb_expand_head(skb_out, 0, size - skb_out->len, GFP_ATOMIC) < 0) {
> kfree_skb(skb_out);
> @@ -307,7 +304,7 @@ bool batadv_frag_skb_buffer(struct sk_buff **skb,
> if (hlist_empty(&head))
> goto out;
>
> - skb_out = batadv_frag_merge_packets(&head, *skb);
> + skb_out = batadv_frag_merge_packets(&head);
> if (!skb_out)
> goto out_err;
>
>
Acked-by: Martin Hundebøll <martin@hundeboll.net>
next prev parent reply other threads:[~2014-12-01 11:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-01 9:37 [B.A.T.M.A.N.] [PATCHv3 1/2] batman-adv: Check total_size when queueing fragments Sven Eckelmann
2014-12-01 9:37 ` [B.A.T.M.A.N.] [PATCHv3 2/2] batman-adv: Use only queued fragments when merging Sven Eckelmann
2014-12-01 11:40 ` Martin Hundebøll [this message]
2015-01-11 10:29 ` Marek Lindner
2014-12-01 11:38 ` [B.A.T.M.A.N.] [PATCHv3 1/2] batman-adv: Check total_size when queueing fragments Martin Hundebøll
2015-01-11 10:27 ` Marek Lindner
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=547C53C5.7090205@hundeboll.net \
--to=martin@hundeboll.net \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=sven@narfation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.