From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Sat, 11 Feb 2012 14:57:45 +0100 From: Antonio Quartulli Message-ID: <20120211135744.GA17826@ritirata.org> References: <1328830902-11574-1-git-send-email-ordex@autistici.org> <1328830902-11574-10-git-send-email-ordex@autistici.org> <201202112144.24340.lindner_marek@yahoo.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="zhXaljGHf11kAtnf" Content-Disposition: inline In-Reply-To: <201202112144.24340.lindner_marek@yahoo.de> Subject: Re: [B.A.T.M.A.N.] [PATCHv5 9/9] batman-adv: Distributed ARP Table - use unicast_4addr_packet for DHT messages Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: The list for a Better Approach To Mobile Ad-hoc Networking --zhXaljGHf11kAtnf Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 tra= ck > > possibly bogus ARP entries) > >=20 > > Signed-off-by: Antonio Quartulli > > --- > > distributed-arp-table.c | 129 > > +++++++++++++++++++++++++++++++--------------- distributed-arp-table.h = | =20 > > 16 +++--- > > soft-interface.c | 15 +++-- > > 3 files changed, 105 insertions(+), 55 deletions(-) > >=20 > > 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 > >=20 > > 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 =3D [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 =3D=3D 0) > > + return; > > + > > + /* if the AP packet is encapsulated in a batman packet, let's print s= ome > > + * debug messages */ > > + unicast_4addr_packet =3D (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 !=3D BAT_P_DHT_PUT || > > + unicast_4addr_packet->subtype !=3D BAT_P_DHT_GET) > > + bat_dbg(DBG_ARP, bat_priv, "It's a DAT message\n"); >=20 > Isn't this check going to fail as soon as a new subtype was added ? >=20 >=20 > > + unicast_4addr_packet =3D (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; > > + >=20 > The unicast_4addr_packet variable isn't used anywhere ... >=20 > Most of this patch simply adds a hdr_size variable to the functions added= by=20 > earlier patches. Why not adding the unicast_4addr type at the beginning o= f the=20 > 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. B= ut I agree with you: moving the new type patch at the beginning is a good idea. Cheers, >=20 > Cheers, > Marek --=20 Antonio Quartulli =2E.each of us alone is worth nothing.. Ernesto "Che" Guevara --zhXaljGHf11kAtnf Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (GNU/Linux) iQEcBAEBAgAGBQJPNnPYAAoJEFMQTLzJFOZF/McIAJyNLuECkVa5lbOUrfD2COhR X5XLHZ3nkVRbAwS5nWqNwKeBHuY6IK5jx+CS1XW7ZaoHhjF6L7RoCCIfIJtZF1BW tVdWyX+yAJIfLk8d2CPuOpJ91v3Tw2rUKeN4I/c3xVrWd9S+Aq3tzwBwvGJBRIC6 V3GaGKp9WPHSEznzBp/krQy0sMrr9+0urj0H+mkD+QdGoogdqSrOAaptXYRFLZFL S9K8eqxHZC7MQP+LP/xOc4AejWYmlvmNj+nDe7gKKu2Q36XDo8j45aYIIjTcyMA8 pS16Af4je/6rRawqJZ6p8vQP/6ULY9bR+ygOQkhPvFKm6AVTYk6BlV6Ob5cPnR0= =s9BQ -----END PGP SIGNATURE----- --zhXaljGHf11kAtnf--