Re: bond procfs hw addr prints

From
Jarod Wilson <hidden>
Date
2017-03-14 02:06:06
Reply to
Jay Vosburgh, 2017-03-14
On 2017-03-13 8:28 PM, Jay Vosburgh wrote:
Jarod Wilson [off-list ref] wrote:
quoted
I've got a bug report for someone using a Intel OPA devices in a bond, and
it appears these devices have a hardware address length of 20, opposed to
the typical 6 on ethernet. When they dump /proc/net/bonding/bondX, it only
prints the first 6 of the address, per %pM and mac_address_string(), while
sysfs for the interface does print the right thing, since it uses
sysfs_print_mac(), which takes a length argument.
	This (20 octet MAC length) is true for any Infiniband device.
quoted
So the question is... What's the best route to take here? Expand %pM to
support variable length hardware addresses? Use sysfs_* in procfs?
Reinvent the wheel? Nothing I've tinkered with just yet feels very clean,
on top of not actually working yet. :)
	sysfs_format_mac (not _print_mac) uses "%*phC", len, addr in its
format string.  Perhaps that format would be a better choice than %pM
for this case?
Ah, I'd failed to fully grasp how %phC worked, had actually tried it w/o the * in there, and only the first char of the addr was printing. Working on an updated version that uses %*phC properly, which does look like the way to go here. (Didn't help that I was also looking at an older codebase that didn't have the sysfs_format_mac de-duplication). I'll try to have a tested patch in flight tomorrow.

-- 
Jarod Wilson
jarod@redhat.com
Thread (5 messages) 5 messages, 2 authors, last reply 2017-03-30
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help