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();
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);
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
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.
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
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
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,
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
b.a.t.m.a.n@lists.open-mesh.org