From: Antonio Quartulli <ordex@autistici.org>
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.] [PATCHv5 9/9] batman-adv: Distributed ARP Table - use unicast_4addr_packet for DHT messages
Date: Sat, 11 Feb 2012 14:57:45 +0100 [thread overview]
Message-ID: <20120211135744.GA17826@ritirata.org> (raw)
In-Reply-To: <201202112144.24340.lindner_marek@yahoo.de>
[-- Attachment #1: Type: text/plain, Size: 3646 bytes --]
On Sat, Feb 11, 2012 at 09:44:23PM +0800, Marek Lindner wrote:
> On Friday, February 10, 2012 07:41:42 Antonio Quartulli wrote:
> > In order to enable an higher verbosity level of the DAT debug messages, the
> > unicast_4addr_packet is now used to carry ARP packets generated by the DAT
> > internal mechanism. This packet type will enable batman-adv to recognise
> > each DAT related message and to print its source (this will help to track
> > possibly bogus ARP entries)
> >
> > Signed-off-by: Antonio Quartulli <ordex@autistici.org>
> > ---
> > distributed-arp-table.c | 129
> > +++++++++++++++++++++++++++++++--------------- distributed-arp-table.h |
> > 16 +++---
> > soft-interface.c | 15 +++--
> > 3 files changed, 105 insertions(+), 55 deletions(-)
> >
> > diff --git a/distributed-arp-table.c b/distributed-arp-table.c
> > index 48e97e0..239b5c4 100644
> > --- a/distributed-arp-table.c
> > +++ b/distributed-arp-table.c
> > @@ -31,6 +31,7 @@
> > #include "originator.h"
> > #include "send.h"
> > #include "soft-interface.h"
> > +#include "translation-table.h"
> > #include "types.h"
> > #include "translation-table.h"
> > #include "unicast.h"
> > @@ -38,10 +39,44 @@
> > #ifdef CONFIG_BATMAN_ADV_DEBUG
> >
> > static inline void bat_dbg_arp(struct bat_priv *bat_priv,
> > - struct sk_buff *skb, uint16_t type) {
> > + struct sk_buff *skb, uint16_t type,
> > + int hdr_size) {
> > + struct unicast_4addr_packet *unicast_4addr_packet;
> > +
> > bat_dbg(DBG_ARP, bat_priv, "ARP MSG = [src: %pM-%pI4 dst: %pM-%pI4]\n",
> > - ARP_HW_SRC(skb), &ARP_IP_SRC(skb), ARP_HW_DST(skb),
> > - &ARP_IP_DST(skb));
> > + ARP_HW_SRC(skb, hdr_size), &ARP_IP_SRC(skb, hdr_size),
> > + ARP_HW_DST(skb, hdr_size), &ARP_IP_DST(skb, hdr_size));
> > +
> > + if (hdr_size == 0)
> > + return;
> > +
> > + /* if the AP packet is encapsulated in a batman packet, let's print some
> > + * debug messages */
> > + unicast_4addr_packet = (struct unicast_4addr_packet *)skb->data;
> > +
> > + switch (unicast_4addr_packet->u.header.packet_type) {
> > + case BAT_UNICAST:
> > + bat_dbg(DBG_ARP, bat_priv, "encapsulated within a UNICAST "
> > + "packet\n");
> > + break;
> > + case BAT_UNICAST_4ADDR:
> > + bat_dbg(DBG_ARP, bat_priv, "encapsulated within a "
> > + "UNICAST_4ADDR packet (src: %pM)\n",
> > + unicast_4addr_packet->src);
> > + if (unicast_4addr_packet->subtype != BAT_P_DHT_PUT ||
> > + unicast_4addr_packet->subtype != BAT_P_DHT_GET)
> > + bat_dbg(DBG_ARP, bat_priv, "It's a DAT message\n");
>
> Isn't this check going to fail as soon as a new subtype was added ?
>
>
> > + unicast_4addr_packet = (struct unicast_4addr_packet *)skb->data;
> > +
> > + if (dat_snoop_incoming_arp_request(bat_priv, skb, hdr_size))
> > + goto out;
> > +
> > + if (dat_snoop_incoming_arp_reply(bat_priv, skb, hdr_size))
> > + goto out;
> > +
>
> The unicast_4addr_packet variable isn't used anywhere ...
>
> Most of this patch simply adds a hdr_size variable to the functions added by
> earlier patches. Why not adding the unicast_4addr type at the beginning of the
> patch series ? You would not need this patch.
Thank you for your feedback.
Yes, you are right. Actually I didn't care about the "weight" of th patch: I
simply added the new type at the end and then applied the needed changes. But I
agree with you: moving the new type patch at the beginning is a good idea.
Cheers,
>
> Cheers,
> Marek
--
Antonio Quartulli
..each of us alone is worth nothing..
Ernesto "Che" Guevara
[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]
next prev parent reply other threads:[~2012-02-11 13:57 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-09 23:41 [B.A.T.M.A.N.] [PATCHv5 0/9] DAT: Distributed ARP Table Antonio Quartulli
2012-02-09 23:41 ` [B.A.T.M.A.N.] [PATCHv5 1/9] batman-adv: implement an helper function to forge unicast packets Antonio Quartulli
2012-02-09 23:41 ` [B.A.T.M.A.N.] [PATCHv5 2/9] batman-adv: add a new log level for DAT/ARP debugging Antonio Quartulli
2012-02-09 23:41 ` [B.A.T.M.A.N.] [PATCHv5 3/9] batman-adv: Distributed ARP Table - create DHT helper functions Antonio Quartulli
2012-02-11 13:59 ` Marek Lindner
2012-02-13 20:33 ` Antonio Quartulli
2012-02-14 6:07 ` Marek Lindner
2012-02-14 7:47 ` Antonio Quartulli
2012-02-09 23:41 ` [B.A.T.M.A.N.] [PATCHv5 4/9] batman-adv: Distributed ARP Table - add ARP parsing functions Antonio Quartulli
2012-02-10 14:21 ` Marek Lindner
2012-02-11 14:09 ` Marek Lindner
2012-02-14 10:43 ` Antonio Quartulli
2012-02-09 23:41 ` [B.A.T.M.A.N.] [PATCHv5 5/9] batman-adv: Distributed ARP Table - add snooping functions for ARP messages Antonio Quartulli
2012-02-10 14:25 ` Marek Lindner
2012-02-09 23:41 ` [B.A.T.M.A.N.] [PATCHv5 6/9] batman-adv: Distributed ARP Table - increase default soft_iface ARP table timeout Antonio Quartulli
2012-02-09 23:41 ` [B.A.T.M.A.N.] [PATCHv5 7/9] batman-adv: Distributed ARP Table - add compile option Antonio Quartulli
2012-02-10 14:32 ` Marek Lindner
2012-02-15 19:47 ` Antonio Quartulli
2012-02-16 6:35 ` Marek Lindner
2012-02-09 23:41 ` [B.A.T.M.A.N.] [PATCHv5 8/9] batman-adv: add UNICAST_4ADDR packet type Antonio Quartulli
2012-02-10 14:42 ` Marek Lindner
2012-02-12 14:27 ` Marek Lindner
2012-02-09 23:41 ` [B.A.T.M.A.N.] [PATCHv5 9/9] batman-adv: Distributed ARP Table - use unicast_4addr_packet for DHT messages Antonio Quartulli
2012-02-11 13:44 ` Marek Lindner
2012-02-11 13:57 ` Antonio Quartulli [this message]
2012-02-09 23:52 ` [B.A.T.M.A.N.] [PATCHv5 0/9] DAT: Distributed ARP Table Antonio Quartulli
2012-02-10 9:44 ` 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=20120211135744.GA17826@ritirata.org \
--to=ordex@autistici.org \
--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;
as well as URLs for NNTP newsgroup(s).