public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH 1/3] batman-adv: print the VID in the dat_cache output
@ 2013-08-22  7:21 Antonio Quartulli
  2013-08-22  7:21 ` [B.A.T.M.A.N.] [PATCH 2/3] batman-adv: fix ARP header parsing in DAT Antonio Quartulli
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Antonio Quartulli @ 2013-08-22  7:21 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Antonio Quartulli

Now that DAT is vlan aware, it should also print the VID
along with the MAC address of each cached entry.

Introduced by: 3e26722bc9f248ec4316749fc1957365c0fa5e4b
("batman-adv: make the Distributed ARP Table vlan aware")

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 distributed-arp-table.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/distributed-arp-table.c b/distributed-arp-table.c
index df65f8c..c825d76 100644
--- a/distributed-arp-table.c
+++ b/distributed-arp-table.c
@@ -761,8 +761,8 @@ int batadv_dat_cache_seq_print_text(struct seq_file *seq, void *offset)
 		goto out;
 
 	seq_printf(seq, "Distributed ARP Table (%s):\n", net_dev->name);
-	seq_printf(seq, "          %-7s          %-13s %5s\n", "IPv4", "MAC",
-		   "last-seen");
+	seq_printf(seq, "          %-7s          %-9s %4s %11s\n", "IPv4",
+		   "MAC", "VID", "last-seen");
 
 	for (i = 0; i < hash->size; i++) {
 		head = &hash->table[i];
@@ -775,8 +775,9 @@ int batadv_dat_cache_seq_print_text(struct seq_file *seq, void *offset)
 			last_seen_msecs = last_seen_msecs % 60000;
 			last_seen_secs = last_seen_msecs / 1000;
 
-			seq_printf(seq, " * %15pI4 %14pM %6i:%02i\n",
+			seq_printf(seq, " * %15pI4 %14pM %4i %6i:%02i\n",
 				   &dat_entry->ip, dat_entry->mac_addr,
+				   BATADV_PRINT_VID(dat_entry->vid),
 				   last_seen_mins, last_seen_secs);
 		}
 		rcu_read_unlock();
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [B.A.T.M.A.N.] [PATCH 2/3] batman-adv: fix ARP header parsing in DAT
  2013-08-22  7:21 [B.A.T.M.A.N.] [PATCH 1/3] batman-adv: print the VID in the dat_cache output Antonio Quartulli
@ 2013-08-22  7:21 ` Antonio Quartulli
  2013-08-25  6:56   ` Marek Lindner
  2013-08-22  7:21 ` [B.A.T.M.A.N.] [PATCH 3/3] batman-adv: tag locally generated ARP reply if needed Antonio Quartulli
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Antonio Quartulli @ 2013-08-22  7:21 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Antonio Quartulli

In case of VLAN packets flowing into the DAT module, the
parsing routines have to consider the correct header size
when accessing an ARP packet.

Introduced by: 3e26722bc9f248ec4316749fc1957365c0fa5e4b
("batman-adv: make the Distributed ARP Table vlan aware")

Reported-by: Marco Dalla Torre <marco.dallato@gmail.com>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Tested-by: Marco Dalla Torre <marco.dallato@gmail.com>
---
 distributed-arp-table.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/distributed-arp-table.c b/distributed-arp-table.c
index c825d76..6eb1ce3 100644
--- a/distributed-arp-table.c
+++ b/distributed-arp-table.c
@@ -922,11 +922,12 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
 	if (type != ARPOP_REQUEST)
 		goto out;
 
-	batadv_dbg_arp(bat_priv, skb, type, 0, "Parsing outgoing ARP REQUEST");
+	batadv_dbg_arp(bat_priv, skb, type, hdr_size,
+		       "Parsing outgoing ARP REQUEST");
 
-	ip_src = batadv_arp_ip_src(skb, 0);
-	hw_src = batadv_arp_hw_src(skb, 0);
-	ip_dst = batadv_arp_ip_dst(skb, 0);
+	ip_src = batadv_arp_ip_src(skb, hdr_size);
+	hw_src = batadv_arp_hw_src(skb, hdr_size);
+	ip_dst = batadv_arp_ip_dst(skb, hdr_size);
 
 	batadv_dat_entry_add(bat_priv, ip_src, hw_src, vid);
 
@@ -956,7 +957,7 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
 		skb_new->protocol = eth_type_trans(skb_new,
 						   bat_priv->soft_iface);
 		bat_priv->stats.rx_packets++;
-		bat_priv->stats.rx_bytes += skb->len + ETH_HLEN;
+		bat_priv->stats.rx_bytes += skb->len + ETH_HLEN + hdr_size;
 		bat_priv->soft_iface->last_rx = jiffies;
 
 		netif_rx(skb_new);
@@ -1069,7 +1070,8 @@ void batadv_dat_snoop_outgoing_arp_reply(struct batadv_priv *bat_priv,
 	if (type != ARPOP_REPLY)
 		return;
 
-	batadv_dbg_arp(bat_priv, skb, type, 0, "Parsing outgoing ARP REPLY");
+	batadv_dbg_arp(bat_priv, skb, type, hdr_size,
+		       "Parsing outgoing ARP REPLY");
 
 	hw_src = batadv_arp_hw_src(skb, hdr_size);
 	ip_src = batadv_arp_ip_src(skb, hdr_size);
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [B.A.T.M.A.N.] [PATCH 3/3] batman-adv: tag locally generated ARP reply if needed
  2013-08-22  7:21 [B.A.T.M.A.N.] [PATCH 1/3] batman-adv: print the VID in the dat_cache output Antonio Quartulli
  2013-08-22  7:21 ` [B.A.T.M.A.N.] [PATCH 2/3] batman-adv: fix ARP header parsing in DAT Antonio Quartulli
@ 2013-08-22  7:21 ` Antonio Quartulli
  2013-08-25  7:06   ` Marek Lindner
  2013-08-22  7:52 ` [B.A.T.M.A.N.] [PATCH 1/3] batman-adv: print the VID in the dat_cache output Marek Lindner
  2013-08-25  6:53 ` Marek Lindner
  3 siblings, 1 reply; 8+ messages in thread
From: Antonio Quartulli @ 2013-08-22  7:21 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Antonio Quartulli

When DAT replies to a client laying on a VLAN it has
to attach to the packet the proper VLAN tag.

Introduced by: 3e26722bc9f248ec4316749fc1957365c0fa5e4b
("batman-adv: make the Distributed ARP Table vlan aware")

Reported-by: Marco Dalla Torre <marco.dallato@gmail.com>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 distributed-arp-table.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/distributed-arp-table.c b/distributed-arp-table.c
index 6eb1ce3..6c8c393 100644
--- a/distributed-arp-table.c
+++ b/distributed-arp-table.c
@@ -953,6 +953,10 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
 		if (!skb_new)
 			goto out;
 
+		if (vid & BATADV_VLAN_HAS_TAG)
+			skb_new = vlan_insert_tag(skb_new, htons(ETH_P_8021Q),
+						  vid & VLAN_VID_MASK);
+
 		skb_reset_mac_header(skb_new);
 		skb_new->protocol = eth_type_trans(skb_new,
 						   bat_priv->soft_iface);
@@ -1024,6 +1028,10 @@ bool batadv_dat_snoop_incoming_arp_request(struct batadv_priv *bat_priv,
 	if (!skb_new)
 		goto out;
 
+	if (vid & BATADV_VLAN_HAS_TAG)
+		skb_new = vlan_insert_tag(skb_new, htons(ETH_P_8021Q),
+					  vid & VLAN_VID_MASK);
+
 	/* To preserve backwards compatibility, the node has choose the outgoing
 	 * format based on the incoming request packet type. The assumption is
 	 * that a node not using the 4addr packet format doesn't support it.
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 1/3] batman-adv: print the VID in the dat_cache output
  2013-08-22  7:21 [B.A.T.M.A.N.] [PATCH 1/3] batman-adv: print the VID in the dat_cache output Antonio Quartulli
  2013-08-22  7:21 ` [B.A.T.M.A.N.] [PATCH 2/3] batman-adv: fix ARP header parsing in DAT Antonio Quartulli
  2013-08-22  7:21 ` [B.A.T.M.A.N.] [PATCH 3/3] batman-adv: tag locally generated ARP reply if needed Antonio Quartulli
@ 2013-08-22  7:52 ` Marek Lindner
  2013-08-22  8:45   ` Antonio Quartulli
  2013-08-25  6:53 ` Marek Lindner
  3 siblings, 1 reply; 8+ messages in thread
From: Marek Lindner @ 2013-08-22  7:52 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Thursday, August 22, 2013 15:21:11 Antonio Quartulli wrote:
> @@ -761,8 +761,8 @@ int batadv_dat_cache_seq_print_text(struct seq_file
> *seq, void *offset) goto out;
>  
>         seq_printf(seq, "Distributed ARP Table (%s):\n", net_dev->name);
> -       seq_printf(seq, "          %-7s          %-13s %5s\n", "IPv4",
> "MAC", -                  "last-seen");
> +       seq_printf(seq, "          %-7s          %-9s %4s %11s\n", "IPv4",
> +                  "MAC", "VID", "last-seen");

Why are you shortening the MAC address length while you try to add the vid ?

Cheers,
Marek

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 1/3] batman-adv: print the VID in the dat_cache output
  2013-08-22  7:52 ` [B.A.T.M.A.N.] [PATCH 1/3] batman-adv: print the VID in the dat_cache output Marek Lindner
@ 2013-08-22  8:45   ` Antonio Quartulli
  0 siblings, 0 replies; 8+ messages in thread
From: Antonio Quartulli @ 2013-08-22  8:45 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

[-- Attachment #1: Type: text/plain, Size: 946 bytes --]

On Thu, Aug 22, 2013 at 03:52:36PM +0800, Marek Lindner wrote:
> On Thursday, August 22, 2013 15:21:11 Antonio Quartulli wrote:
> > @@ -761,8 +761,8 @@ int batadv_dat_cache_seq_print_text(struct seq_file
> > *seq, void *offset) goto out;
> >  
> >         seq_printf(seq, "Distributed ARP Table (%s):\n", net_dev->name);
> > -       seq_printf(seq, "          %-7s          %-13s %5s\n", "IPv4",
> > "MAC", -                  "last-seen");
> > +       seq_printf(seq, "          %-7s          %-9s %4s %11s\n", "IPv4",
> > +                  "MAC", "VID", "last-seen");
> 
> Why are you shortening the MAC address length while you try to add the vid ?

This is only to arrange the header line. If you test the code, you will see it
looks good this way :) I also added some more space at the last-seen text to
space it correctly.

Cheers,

-- 
Antonio Quartulli

..each of us alone is worth nothing..
Ernesto "Che" Guevara

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 1/3] batman-adv: print the VID in the dat_cache output
  2013-08-22  7:21 [B.A.T.M.A.N.] [PATCH 1/3] batman-adv: print the VID in the dat_cache output Antonio Quartulli
                   ` (2 preceding siblings ...)
  2013-08-22  7:52 ` [B.A.T.M.A.N.] [PATCH 1/3] batman-adv: print the VID in the dat_cache output Marek Lindner
@ 2013-08-25  6:53 ` Marek Lindner
  3 siblings, 0 replies; 8+ messages in thread
From: Marek Lindner @ 2013-08-25  6:53 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Antonio Quartulli

On Thursday, August 22, 2013 15:21:11 Antonio Quartulli wrote:
> Now that DAT is vlan aware, it should also print the VID
> along with the MAC address of each cached entry.
> 
> Introduced by: 3e26722bc9f248ec4316749fc1957365c0fa5e4b
> ("batman-adv: make the Distributed ARP Table vlan aware")
> 
> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
> ---
>  distributed-arp-table.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

Applied in revision 19c31e8.

Thanks,
Marek

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 2/3] batman-adv: fix ARP header parsing in DAT
  2013-08-22  7:21 ` [B.A.T.M.A.N.] [PATCH 2/3] batman-adv: fix ARP header parsing in DAT Antonio Quartulli
@ 2013-08-25  6:56   ` Marek Lindner
  0 siblings, 0 replies; 8+ messages in thread
From: Marek Lindner @ 2013-08-25  6:56 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking
  Cc: Antonio Quartulli

On Thursday, August 22, 2013 15:21:12 Antonio Quartulli wrote:
> In case of VLAN packets flowing into the DAT module, the
> parsing routines have to consider the correct header size
> when accessing an ARP packet.
> 
> Introduced by: 3e26722bc9f248ec4316749fc1957365c0fa5e4b
> ("batman-adv: make the Distributed ARP Table vlan aware")
> 
> Reported-by: Marco Dalla Torre <marco.dallato@gmail.com>
> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
> Tested-by: Marco Dalla Torre <marco.dallato@gmail.com>
> ---
>  distributed-arp-table.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)

Applied in revision ae6b6b3.

Thanks,
Marek

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 3/3] batman-adv: tag locally generated ARP reply if needed
  2013-08-22  7:21 ` [B.A.T.M.A.N.] [PATCH 3/3] batman-adv: tag locally generated ARP reply if needed Antonio Quartulli
@ 2013-08-25  7:06   ` Marek Lindner
  0 siblings, 0 replies; 8+ messages in thread
From: Marek Lindner @ 2013-08-25  7:06 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Antonio Quartulli

On Thursday, August 22, 2013 15:21:13 Antonio Quartulli wrote:
> When DAT replies to a client laying on a VLAN it has
> to attach to the packet the proper VLAN tag.
> 
> Introduced by: 3e26722bc9f248ec4316749fc1957365c0fa5e4b
> ("batman-adv: make the Distributed ARP Table vlan aware")
> 
> Reported-by: Marco Dalla Torre <marco.dallato@gmail.com>
> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
> ---
>  distributed-arp-table.c | 8 ++++++++
>  1 file changed, 8 insertions(+)

Applied in revision 53c6c26.

Thanks,
Marek

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-08-25  7:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-22  7:21 [B.A.T.M.A.N.] [PATCH 1/3] batman-adv: print the VID in the dat_cache output Antonio Quartulli
2013-08-22  7:21 ` [B.A.T.M.A.N.] [PATCH 2/3] batman-adv: fix ARP header parsing in DAT Antonio Quartulli
2013-08-25  6:56   ` Marek Lindner
2013-08-22  7:21 ` [B.A.T.M.A.N.] [PATCH 3/3] batman-adv: tag locally generated ARP reply if needed Antonio Quartulli
2013-08-25  7:06   ` Marek Lindner
2013-08-22  7:52 ` [B.A.T.M.A.N.] [PATCH 1/3] batman-adv: print the VID in the dat_cache output Marek Lindner
2013-08-22  8:45   ` Antonio Quartulli
2013-08-25  6:53 ` Marek Lindner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox