An output mac address is 17 bytes
1
12345678901234567
00:11:22:33:44:55
but in net/batman-adv/distributed-arp-table.c
int batadv_dat_cache_seq_print_text(struct seq_file *seq, void *offset)
{
[...]
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);
%14pM is odd as this should not emit the last byte of the
mac address. So given the example above, it would output
00:11:22:33:44
Is that what's really desired?
If so, I'd suggest using something more obvious like %5phC
On Dienstag, 13. Juni 2017 14:51:41 CEST Joe Perches wrote:
> An output mac address is 17 bytes
[...]
> but in net/batman-adv/distributed-arp-table.c
[...]
> %14pM is odd as this should not emit the last byte of the
> mac address. So given the example above, it would output
> 00:11:22:33:44
[...]
I completely agree too the "wrong length" part. It is currently not omitting
the last byte:
Distributed ARP Table (bat0):
IPv4 MAC VID last-seen
* 10.204.28.206 e8:50:8b:8b:71:8d -1 4:05
* 10.204.77.54 6c:2f:2c:43:70:eb -1 1:56
* 10.25.21.138 ec:1f:72:c3:15:51 -1 4:21
* 10.204.27.220 08:70:45:8c:ac:db -1 2:32
* 192.168.42.22 64:66:b3:bb:8e:ef -1 0:18
* 10.204.64.1 02:ba:7a:df:04:00 -1 0:00
* 192.168.42.27 e8:de:27:f9:0f:48 -1 0:32
But it definitely also not "correct". I see something similar in the IV OGM
code:
net/batman-adv/bat_iv_ogm.c: "bidirectional: orig = %-15pM neigh = %-15pM => own_bcast = %2i, real recv = %2i, local tq: %3i, asym_penalty: %3i, iface_penalty: %3i, total tq: %3i, if_incoming = %s, if_outgoing = %s\n",
Do you want to provide a patch to convert it to simple %pM's?
Kind regards,
Sven
On Wed, 2017-06-14 at 10:23 +0200, Sven Eckelmann wrote:
> On Dienstag, 13. Juni 2017 14:51:41 CEST Joe Perches wrote:
> > An output mac address is 17 bytes
>
> [...]
> > but in net/batman-adv/distributed-arp-table.c
>
> [...]
> > %14pM is odd as this should not emit the last byte of the
> > mac address. So given the example above, it would output
> > 00:11:22:33:44
>
> [...]
>
> I completely agree too the "wrong length" part. It is currently not omitting
> the last byte:
Right, I only looked at vsprintf.c and mistook precision for
field_width.
Do you want to provide a patch to convert it to simple %pM's?
OK.
It's misleading and unnecessary.
Signed-off-by: Joe Perches <[email protected]>
---
net/batman-adv/distributed-arp-table.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c
index 6930d6b50f99..b6cfa78e9381 100644
--- a/net/batman-adv/distributed-arp-table.c
+++ b/net/batman-adv/distributed-arp-table.c
@@ -834,7 +834,7 @@ 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 %4i %6i:%02i\n",
+ seq_printf(seq, " * %15pI4 %pM %4i %6i:%02i\n",
&dat_entry->ip, dat_entry->mac_addr,
batadv_print_vid(dat_entry->vid),
last_seen_mins, last_seen_secs);
--
2.10.0.rc2.1.g053435c
From: Joe Perches <[email protected]>
Date: Wed, 14 Jun 2017 02:33:52 -0700
> It's misleading and unnecessary.
>
> Signed-off-by: Joe Perches <[email protected]>
Simon will you take this into your batman-adv tree?
Thanks.
On Mittwoch, 14. Juni 2017 02:33:52 CEST Joe Perches wrote:
> It's misleading and unnecessary.
>
> Signed-off-by: Joe Perches <[email protected]>
> ---
> net/batman-adv/distributed-arp-table.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
The patch was applied and is currently queued up as
454ea1866ef45c6f1b747bd27a8203318be72b5d in batadv/net-next.
Thanks,
Sven