From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Marek Lindner Date: Sat, 11 Feb 2012 21:44:23 +0800 References: <1328830902-11574-1-git-send-email-ordex@autistici.org> <1328830902-11574-10-git-send-email-ordex@autistici.org> In-Reply-To: <1328830902-11574-10-git-send-email-ordex@autistici.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <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 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 > --- > 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. Cheers, Marek