From: Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>
To: The list for a Better Approach To Mobile Ad-hoc Networking
<b.a.t.m.a.n@lists.open-mesh.org>
Subject: Re: [B.A.T.M.A.N.] [PATCH 07/19] batman-adv: Prepare and send own multicast tracker packets
Date: Sun, 23 Jan 2011 03:52:31 +0100 [thread overview]
Message-ID: <20110123025231.GA15942@pandem0nium> (raw)
In-Reply-To: <1295659302-7171-8-git-send-email-linus.luessing@saxnet.de>
[-- Attachment #1: Type: text/plain, Size: 2773 bytes --]
Hello,
found one more thing which will break packet sending, please see inline:
On Sat, Jan 22, 2011 at 02:21:30AM +0100, Linus Lüssing wrote:
> [...]
> +/**
> + * Sends (splitted parts of) a multicast tracker packet on the according
> + * interfaces.
> + *
> + * @tracker_packet: A compact multicast tracker packet with all groups and
> + * destinations attached.
> + */
> +void route_mcast_tracker_packet(
> + struct mcast_tracker_packet *tracker_packet,
> + int tracker_packet_len, struct bat_priv *bat_priv)
> +{
> + struct dest_entries_list next_hops, *tmp;
> + struct mcast_tracker_packet *next_hop_tracker_packets,
> + *next_hop_tracker_packet;
> + struct dest_entries_list *next_hop;
> + struct sk_buff *skb;
> + int num_next_hops, i;
> + int *tracker_packet_lengths;
> +
> + rcu_read_lock();
> + num_next_hops = tracker_next_hops(tracker_packet, &next_hops,
> + bat_priv);
> + if (!num_next_hops)
> + goto out;
> + next_hop_tracker_packets = kmalloc(tracker_packet_len * num_next_hops,
> + GFP_ATOMIC);
> + if (!next_hop_tracker_packets)
> + goto free;
> +
> + tracker_packet_lengths = kmalloc(num_next_hops * sizeof(int),
> + GFP_ATOMIC);
> + if (!tracker_packet_lengths)
> + goto free2;
> +
> + i = 0;
> + list_for_each_entry_safe(next_hop, tmp, &next_hops.list, list) {
> + next_hop_tracker_packet = (struct mcast_tracker_packet *)
> + ((char *)next_hop_tracker_packets +
> + i * tracker_packet_len);
> + memcpy(next_hop_tracker_packet, tracker_packet,
> + tracker_packet_len);
> + zero_tracker_packet(next_hop_tracker_packet, next_hop->dest,
> + bat_priv);
> + tracker_packet_lengths[i] = shrink_tracker_packet(
> + next_hop_tracker_packet, tracker_packet_len);
> + i++;
> + }
> +
> + i = 0;
> + /* Add ethernet header, send 'em! */
> + list_for_each_entry_safe(next_hop, tmp, &next_hops.list, list) {
> + if (tracker_packet_lengths[i] ==
> + sizeof(struct mcast_tracker_packet))
> + goto skip_send;
> +
> + skb = build_tracker_packet_skb(&next_hop_tracker_packets[i],
Don't use next_hop_tracker_packets[i]! This will give you a wrong
pointer, because the base is "sizeof(struct mcast_tracker_packet)"
and not "tracker_packet_len". Instead, please use a
"next_hop_tracker_packet" construct like in the loop above.
(BTW, i think you could merge the two loops and skip the array
"tracker_packet_lengths" for keeping the lengths, i think ...)
> + tracker_packet_lengths[i],
> + next_hop->dest);
> + if (skb)
> + send_skb_packet(skb, next_hop->batman_if,
> + next_hop->dest);
> +skip_send:
> + list_del(&next_hop->list);
> + kfree(next_hop);
> + i++;
> + }
> +
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
next prev parent reply other threads:[~2011-01-23 2:52 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-22 1:21 [B.A.T.M.A.N.] B.A.T.M.A.N.-Advanced Multicast Optimizations, v2 Linus Lüssing
2011-01-22 1:21 ` [B.A.T.M.A.N.] [PATCH 01/19] batman-adv: Add packet structures for multicast optimizations Linus Lüssing
2011-01-22 1:21 ` [B.A.T.M.A.N.] [PATCH 02/19] batman-adv: Adding configurable variables " Linus Lüssing
2011-01-22 1:21 ` [B.A.T.M.A.N.] [PATCH 03/19] batman-adv: compat macros/defines for local multicast group fetching Linus Lüssing
2011-01-23 0:50 ` Linus Lüssing
2011-01-22 1:21 ` [B.A.T.M.A.N.] [PATCH 04/19] batman-adv: Attach local MCAs to OGMs Linus Lüssing
2011-01-22 1:21 ` [B.A.T.M.A.N.] [PATCH 05/19] batman-adv: Add periodic multicast tracker timer Linus Lüssing
2011-01-22 1:21 ` [B.A.T.M.A.N.] [PATCH 06/19] batman-adv: Buffer other originator's received MCA entries Linus Lüssing
2011-01-22 1:21 ` [B.A.T.M.A.N.] [PATCH 07/19] batman-adv: Prepare and send own multicast tracker packets Linus Lüssing
2011-01-22 22:00 ` Simon Wunderlich
2011-01-30 4:49 ` Linus Lüssing
2011-01-23 0:52 ` Linus Lüssing
2011-01-23 2:52 ` Simon Wunderlich [this message]
2011-01-23 3:00 ` Simon Wunderlich
2011-01-22 1:21 ` [B.A.T.M.A.N.] [PATCH 08/19] batman-adv: Add length check for (received) " Linus Lüssing
2011-01-22 1:21 ` [B.A.T.M.A.N.] [PATCH 09/19] batman-adv: Route multicast " Linus Lüssing
2011-01-22 1:21 ` [B.A.T.M.A.N.] [PATCH 10/19] batman-adv: Add/refresh entries to/in mcast forwarding table Linus Lüssing
2011-01-22 22:13 ` Simon Wunderlich
2011-01-22 1:21 ` [B.A.T.M.A.N.] [PATCH 11/19] batman-adv: Output mcast forw table in debugfs Linus Lüssing
2011-01-22 1:21 ` [B.A.T.M.A.N.] [PATCH 12/19] batman-adv: Purge timeouted entries in mcast forw table Linus Lüssing
2011-01-22 1:21 ` [B.A.T.M.A.N.] [PATCH 13/19] batman-adv: Send own BAT_MCAST packets in proact_tracking multicast mode Linus Lüssing
2011-01-22 1:21 ` [B.A.T.M.A.N.] [PATCH 14/19] batman-adv: Export broadcast packet ethernet header checks Linus Lüssing
2011-01-22 1:21 ` [B.A.T.M.A.N.] [PATCH 15/19] batman-adv: Receive multicast data packets BAT_MCAST Linus Lüssing
2011-01-22 1:21 ` [B.A.T.M.A.N.] [PATCH 16/19] batman-adv: Forward multicast data in proact_tracking mode Linus Lüssing
2011-01-22 1:21 ` [B.A.T.M.A.N.] [PATCH 17/19] batman-adv: Add duplicate checks for multicast data Linus Lüssing
2011-01-22 1:21 ` [B.A.T.M.A.N.] [PATCH 18/19] batman-adv: Still flood multicast packets we are not a receiver of Linus Lüssing
2011-01-22 1:21 ` [B.A.T.M.A.N.] [PATCH 19/19] batman-adv: Make number of (re)broadcasts configurable via sysfs Linus Lüssing
2011-01-22 16:16 ` [B.A.T.M.A.N.] B.A.T.M.A.N.-Advanced Multicast Optimizations, v2 Linus Lüssing
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=20110123025231.GA15942@pandem0nium \
--to=simon.wunderlich@s2003.tu-chemnitz.de \
--cc=b.a.t.m.a.n@lists.open-mesh.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