bonding: show full hw address in sysfs for slave entries
Subsystems (3)
PATCH 1/1 bonding: show full hw address in sysfs for slave entries
Bond expects ethernet hwaddr for its slave, but it can be longer than 6 bytes - infiniband interface for example.
# cat /sys/devices/<skipped>/net/ib0/address 80:00:02:08:fe:80:00:00:00:00:00:00:7c:fe:90:03:00:be:5d:e1
# cat /sys/devices/<skipped>/net/ib0/bonding_slave/perm_hwaddr 80:00:02:08:fe:80
So print full hwaddr in sysfs "bonding_slave/perm_hwaddr" as well.
--- drivers/net/bonding/bond_sysfs_slave.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/bonding/bond_sysfs_slave.c +3 -1
@@ -55,7 +55,9 @@ static SLAVE_ATTR_RO(link_failure_count);static ssize_t perm_hwaddr_show (struct slave *slave,char *buf) { -return sprintf (buf,"%pM\n" , slave->perm_hwaddr); +return sprintf (buf,"%*phC\n" , + slave->dev->addr_len, + slave->perm_hwaddr); }static SLAVE_ATTR_RO (perm_hwaddr);
Signature · 1 line
2.15.1
Quoted 21 lines · Konstantin Khorenko
Bond expects ethernet hwaddr for its slave, but it can be longer than 6 bytes - infiniband interface for example.
# cat /sys/devices/<skipped>/net/ib0/address 80:00:02:08:fe:80:00:00:00:00:00:00:7c:fe:90:03:00:be:5d:e1# cat /sys/devices/<skipped>/net/ib0/bonding_slave/perm_hwaddr 80:00:02:08:fe:80So print full hwaddr in sysfs "bonding_slave/perm_hwaddr" as well.
Signed-off-by Konstantin Khorenko <[email protected]>---
drivers/net/bonding/bond_sysfs_slave.c| 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)drivers/net/bonding/bond_sysfs_slave.c +0
-0
drivers/net/bonding/bond_sysfs_slave.c static SLAVE_ATTR_RO(link_failure_count); · line 62
Quoted 9 lines
drivers/net/bonding/bond_sysfs_slave.c +3
-1@@ -55,7 +55,9 @@ static SLAVE_ATTR_RO(link_failure_count);static ssize_t perm_hwaddr_show (struct slave *slave,char *buf) { -return sprintf (buf,"%pM\n" , slave->perm_hwaddr); +return sprintf (buf,"%*phC\n" , + slave->dev->addr_len, + slave->perm_hwaddr); }static SLAVE_ATTR_RO (perm_hwaddr);
-J
---
-Jay Vosburgh, [email protected]
From: Konstantin Khorenko <[email protected]>
Date: Thu, 28 Mar 2019 13:29:21 +0300
Quoted 6 lines
Bond expects ethernet hwaddr for its slave, but it can be longer than 6 bytes - infiniband interface for example.
# cat /sys/devices/<skipped>/net/ib0/address 80:00:02:08:fe:80:00:00:00:00:00:00:7c:fe:90:03:00:be:5d:e1
Quoted 6 lines
# cat /sys/devices/<skipped>/net/ib0/bonding_slave/perm_hwaddr 80:00:02:08:fe:80So print full hwaddr in sysfs "bonding_slave/perm_hwaddr" as well.
Signed-off-by Konstantin Khorenko <[email protected]>
Applied, thanks.